+ Reply to Thread
Results 1 to 10 of 10

Calculating closest x,y co ordinate from a list

  1. #1
    Registered User
    Join Date
    12-31-2012
    Location
    Perth WA
    MS-Off Ver
    Excel 2007
    Posts
    3

    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. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel (Windows 11 64-bit)
    Posts
    59,477

    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.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" to anyone who has offered you help in your thread. You can reward them by clicking on * Add Reputation below theur user name on the left, if you wish.


    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.

  3. #3
    Forum Expert sandy666's Avatar
    Join Date
    02-05-2015
    Location
    Any Country
    MS-Off Ver
    farerwell
    Posts
    8,749

    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
    Attached Files Attached Files
    sandy
    How to create an editor for Power Query with Notepad++ (tutorial)
    How to create timeline project with vertical today marker (2010, 2013, 2016 etc...) (examples)
    Tips for Excellent Spreadsheets

    What makes learning so hard is the amount of knowledge you have to unlearn
    Why is my program not doing what I expect?
    Because you set the wrong expectations. Rewire your brain

  4. #4
    Registered User
    Join Date
    12-31-2012
    Location
    Perth WA
    MS-Off Ver
    Excel 2007
    Posts
    3

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

    attached is the mock data with the intended results..
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    12-31-2012
    Location
    Perth WA
    MS-Off Ver
    Excel 2007
    Posts
    3

    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
    Last edited by turbojon; 04-17-2017 at 12:03 AM.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel (Windows 11 64-bit)
    Posts
    59,477

    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. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel (Windows 11 64-bit)
    Posts
    59,477

    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. #8
    Forum Expert sandy666's Avatar
    Join Date
    02-05-2015
    Location
    Any Country
    MS-Off Ver
    farerwell
    Posts
    8,749

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

    Quote Originally Posted by turbojon View Post
    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
    Last edited by sandy666; 04-17-2017 at 06:11 AM.

  9. #9
    Forum Expert sandy666's Avatar
    Join Date
    02-05-2015
    Location
    Any Country
    MS-Off Ver
    farerwell
    Posts
    8,749

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

    Thanks for rep, but

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel (Windows 11 64-bit)
    Posts
    59,477

    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.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Retrieving the Closest Larger / Closest Smaller Values from a List
    By ChipsSlave in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-31-2017, 08:38 AM
  2. problem with ordinate from a to z
    By bogd1n in forum Excel General
    Replies: 5
    Last Post: 03-06-2016, 01:50 PM
  3. [SOLVED] Formula Calculating next closest rebate tier to achieve with qty
    By fumetsu in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 05-04-2015, 02:13 AM
  4. [SOLVED] get 10 Closest Larger / Closest Smaller Values from a List
    By Auni in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-19-2013, 04:07 AM
  5. calculating points total, with formula to look above for closest item name
    By david1987 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-21-2012, 10:39 AM
  6. Calculating the closest score
    By AussieM8 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-24-2007, 08:21 PM
  7. Replies: 0
    Last Post: 08-25-2005, 02:37 AM

Bookmarks

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