如何查找给定地址 5 英里范围内的位置数量?

问题描述 投票:0回答:1

我正在处理加油站

Lat/Long
坐标列表,并尝试查找给定位置 5 英里范围内有多少个加油站。

我们需要找出标准加油站 5 英里范围内有多少个备用加油站。

enter image description here

我们一直在尝试多种公式来获取这些值,但没有取得任何成功。

以下公式提供了从指定加油站到替代加油站的距离:

=IFERROR(INDEX(ACOS(COS(RADIANS(90-RD_Stations!$C$3:$C$5000))*COS(RADIANS(90-$R3))+SIN(RADIANS(90-RD_Stations!$C$3:$C$5000))*SIN(RADIANS(90-$R3))*COS(RADIANS(RD_Stations!$D$3:$D$5000-$S3)))*6371,MATCH(SMALL((ABS($R3-RD_Stations!$C$3:$C$5000)^2+ABS($S3-RD_Stations!$D$3:$D$5000)^2)^(0.5),1),(ABS($R3-RD_Stations!$C$3:$C$5000)^2+ABS($S3-RD_Stations!$D$3:$D$5000)^2)^(0.5),0)),0)

现在我们尝试使用以下公式来查找距离原始加油站不到 5 英里的记录数:

=SMALL((ABS($R3-RD_Stations!$C$3:$C$5000)^2+ABS($S3-RD_Stations!$D$3:$D$5000)^2)^(0.5),1)

我已经能够拉动个人距离,但无法找到一种方法来获得最接近到最远的排名,最大值为 5 英里。

excel coordinates latitude-longitude haversine
1个回答
0
投票

假设您正在计算完美球体上的大圆距离,并且没有

FILTER
SORT
,请尝试如下操作:

纬度 经度
0号站 37,04271 -122,025
距离(海里) 最大距离(NM) 最大距离内的车站 前10名
1号站 34,49374 -118,199
=ROUND(DEGREES(ACOS(ROUND(COS(RADIANS(90-$B$2)),15)*ROUND(COS(RADIANS(90-B4)),15)+ROUND(SIN(RADIANS(90-$B$2)),15)*ROUND(SIN(RADIANS(90-B4)),15)*ROUND(COS(RADIANS(ABS($C$2-C4))),15))),15)*60
5
=COUNTIFS(E4:E6,"<="&G4,E4:E6,">"&0)
=IFERROR(AGGREGATE(15,6,$E$4:$E$6/($E$4:$E$6<=$G$4)/($E$4:$E$6<>0),ROWS($I$4:I4)),"-")
2号站 34,09878 -117,585
=ROUND(DEGREES(ACOS(ROUND(COS(RADIANS(90-$B$2)),15)*ROUND(COS(RADIANS(90-B5)),15)+ROUND(SIN(RADIANS(90-$B$2)),15)*ROUND(SIN(RADIANS(90-B5)),15)*ROUND(COS(RADIANS(ABS($C$2-C5))),15))),15)*60
=IFERROR(AGGREGATE(15,6,$E$4:$E$6/($E$4:$E$6<=$G$4)/($E$4:$E$6<>0),ROWS($I$4:I5)),"-")
3号站 37,04271 -122,025
=ROUND(DEGREES(ACOS(ROUND(COS(RADIANS(90-$B$2)),15)*ROUND(COS(RADIANS(90-B6)),15)+ROUND(SIN(RADIANS(90-$B$2)),15)*ROUND(SIN(RADIANS(90-B6)),15)*ROUND(COS(RADIANS(ABS($C$2-C6))),15))),15)*60
=IFERROR(AGGREGATE(15,6,$E$4:$E$6/($E$4:$E$6<=$G$4)/($E$4:$E$6<>0),ROWS($I$4:I6)),"-")
=IFERROR(AGGREGATE(15,6,$E$4:$E$6/($E$4:$E$6<=$G$4)/($E$4:$E$6<>0),ROWS($I$4:I7)),"-")
=IFERROR(AGGREGATE(15,6,$E$4:$E$6/($E$4:$E$6<=$G$4)/($E$4:$E$6<>0),ROWS($I$4:I8)),"-")
=IFERROR(AGGREGATE(15,6,$E$4:$E$6/($E$4:$E$6<=$G$4)/($E$4:$E$6<>0),ROWS($I$4:I9)),"-")
=IFERROR(AGGREGATE(15,6,$E$4:$E$6/($E$4:$E$6<=$G$4)/($E$4:$E$6<>0),ROWS($I$4:I10)),"-")
=IFERROR(AGGREGATE(15,6,$E$4:$E$6/($E$4:$E$6<=$G$4)/($E$4:$E$6<>0),ROWS($I$4:I11)),"-")
=IFERROR(AGGREGATE(15,6,$E$4:$E$6/($E$4:$E$6<=$G$4)/($E$4:$E$6<>0),ROWS($I$4:I12)),"-")
=IFERROR(AGGREGATE(15,6,$E$4:$E$6/($E$4:$E$6<=$G$4)/($E$4:$E$6<>0),ROWS($I$4:I13)),"-")

我用自己的公式来计算距离。你当然可以用你的来代替。请注意,我的结果以海里为单位。您可能正在寻找法定里程。

© www.soinside.com 2019 - 2024. All rights reserved.