# Calculating closest x,y co ordinate from a list

1. ## Calculating closest x,y co ordinate from a list

Hello

I have a list of names and their respective 'entry' saved as X,Y co ordinates.

I am struggling to find the correct formula to display a list of 20 people who are closest to the winning co ordinates. Lets say the winning co ordinates are 1332,169. I want to be able to find the top 20 people who were closest to those winning co ordinates from a list.

xy.JPG

this list has mock data in by the way.

Is there anyway I can search through to see the closest 20 entries?

2. ## Re: Calculating closest x,y co ordinate from a list

Welcome to the forum!

Will you please attach a sample Excel workbook? We are not able to work with or manipulate a picture of one.

1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

2. Make sure that your desired solution is also shown (mock up the results manually).

3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

4. Try to avoid using merged cells as they cause lots of problems.

Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.

3. ## Re: Calculating closest x,y co ordinate from a list

Maybe something like this but without an attachment (xlsx|xlsm - not a picture, and data BEFORE and AFTER) it's hard to say anything more

4. ## Re: Calculating closest x,y co ordinate from a list

attached is the mock data with the intended results..

5. ## Re: Calculating closest x,y co ordinate from a list

sandy i think your solution is quite elegant! how would one adjust the yellow drop down bar to include say 1000 records? Really appreciate your help

6. ## Re: Calculating closest x,y co ordinate from a list

Here's another solution using a helper column in H.

Excel 2016 (Windows) 32 bit
H
2
=ABS(F2-\$J\$1)+ABS(G2-\$K\$1)
 Sheet: data

Excel 2016 (Windows) 32 bit
J
5
=INDEX(B:B,MATCH(SMALL(H:H,1),H:H,0))&" "&INDEX(C:C,MATCH(SMALL(H:H,1),H:H,0))
6
=INDEX(\$B:\$B,MATCH(SMALL(\$H:\$H,COLUMNS(\$I6:J6)),\$H:\$H,0))&" "&INDEX(\$C:\$C,MATCH(SMALL(\$H:\$H,COLUMNS(\$I6:J6)),\$H:\$H,0))
 Sheet: data

The formula in H2 can be copied down and the one in J6 copied across.

7. ## Re: Calculating closest x,y co ordinate from a list

As a footnote, since you haven't told us what your expected outcome is, i.e. who you think the top 5 are, we have each interpreted the word 'closest' in a different way. In my solution, I've calculated the sum of the difference between the coordinates to work out a point score for each player, and then listed the five with the closest amalgamated scores. It would help if you told us what your definition of 'closest' is.

8. ## Re: Calculating closest x,y co ordinate from a list

Originally Posted by turbojon
sandy i think your solution is quite elegant! how would one adjust the yellow drop down bar to include say 1000 records? Really appreciate your help
Change reference from 56 to 1000

01repsolv.gif

dv.jpg

9. ## Re: Calculating closest x,y co ordinate from a list

Thanks for rep, but

10. ## Re: Calculating closest x,y co ordinate from a list

Yes, thanks for the rep. I'd also like to know whose interpretation of your requirement was correct - mine or Sandy's? Thanks.

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1