troubleshooting Question

Help me find the 3-10 closest locations

Avatar of Jospeh F
Jospeh F asked on
Microsoft ExcelMicrosoft Office
2 Comments1 Solution121 ViewsLast Modified:
Hello there,

I have 35,000 locations. I want a formula that will find the closest 3 points from the same list. There was a prior question and solution here, but I cannot get it to work:

https://www.experts-exchange.com/questions/28561261/Find-10-closest-x-y-coordinates-between-two-huge-x-y-data-set.html

Here's my data:

Unique identifiers:
$A$2:$A$35651

Latitude:
$J$2:$J$35651

Longitude:
$K$2:$K$35651

Based on the question above I modified the formula that looked like a solution:

=SUM(IF(SQRT(($J2-$J$2:$J$35651)^2+($K2-$K$2:$K$35651)^2)=SMALL(IF($J$2:$J$35651="","",SQRT(($J2-$J$2:$J$35651)^2+($K2-$K$2:$K$35651)^2)),2),$N$2:$N$35651,0))

This returns a #NUM! error.

Nearby locations are in LM, LN, and LO2. I doubt we'd need to reference those, but some people used them in the event of a tie. Breaking a tie is a nice feature, but ties in my dataset will be so rare that it's more of a "nice to have" if you see an easy solution.

It looks like they're mostly using the SMALL(array,k) to get the second-closest value, which I understand. I can easily change the K and lookup range, or you can use RIGHT(LM1,1)+1 to get 2 since the column is called NearbyPlace1, NearbyPlace2, etc. And I assume we'll start with 2 because 1 would just re-find the current location.
ASKER CERTIFIED SOLUTION
aikimark
Get vaccinated; Social distance; Wear a mask

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Top Expert 2014

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros