我有~90个位置的列表,我需要计算这些位置之间的鹰眼距离。我使用以下公式来计算以英里为单位的距离:
=ACOS(COS(RADIANS(90-$F3))*COS(RADIANS(90-$F$2))+SIN(RADIANS(90-$F3))*SIN(RADIANS(90-$F$2))*COS(RADIANS($G3-$G$2)))*3958.756
我的想法是,一旦我拥有了H列的所有公式,我只需要向右拖动列并固定新位置,这样当矩阵中的位置与自身匹配时,距离将是零。
我一直在尝试使用TRANSPOSE和OFFSET而没有任何成功,任何想法?
答案 0 :(得分:0)
输入
=IF(ROW(A1)>COLUMN(A1),ACOS(COS(RADIANS(90-$F2))*COS(RADIANS(90-INDEX($F$2:$F$5,COLUMN(A1))))+SIN(RADIANS(90-$F2))*SIN(RADIANS(90-INDEX($F$2:$F$5,COLUMN(A1))))*COS(RADIANS($G2-INDEX($G$2:$G$5,COLUMN(A1)))))*3958.756,"")
H2
中的(此单元格将为空)并将其复制/拖动以填充
整个表H2:K5
(一些随机lon/lat
):
此处ROW(A1)
,COLUMN(A1)
是一种使用i,j
索引的懒惰方式
表元素。
以防万一,结构化形式的相同公式:
IF(
ROW(A1)>COLUMN(A1),
ACOS(COS(RADIANS(90-$F2))*COS(RADIANS(90-INDEX($F$2:$F$5,COLUMN(A1))))
+SIN(RADIANS(90-$F2))*SIN(RADIANS(90-INDEX($F$2:$F$5,COLUMN(A1))))
*COS(RADIANS($G2-INDEX($G$2:$G$5,COLUMN(A1)))))*3958.756,
""
)
答案 1 :(得分:0)