Results 1 to 8 of 8

Nearest neighbour limited by point type

Threaded View

  1. #1
    Registered User
    Join Date
    05-26-2013
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    79

    Question Nearest neighbour limited by point type

    Hi all,

    I have a list of x and y xoordinates all with a respective ID and point type (either "RO" or "RP"). I wish to define the nearest other point by ID for every point but I wish to limit this calculation to only points of the opposite type. That is, if I have point ID 315 which is of RO type, I wish to find the nearest point that is of RP type, and visa-versa.

    So far through reading many forums and posts and spending quite some time editing I have managed to create a solution for finding the nearest other point but not limit this to the opposite point type. My scenario is as follows...

    M N O P Q
    1 RO 311 478113 6771180 312
    2 RO 312 478105 6771179 ?
    3 RO 313 478096 6771178 ?
    4 RP 314 478088 6771177 ?
    5 RP 315 478080 6771176 ?
    6 RP 316 478071 6771175 ?

    Where... M=Type, N=ID, O=X-coordinate, P=Y-coordinate, Q=Nearest Point

    The table shown consists of cells M1:Q7 but the entire table I wish to select from will pontentially be M1:Q1000. Obviously I cannot have 312 as the nearest ID to 311 as it must be of RP type. Please note that the table shown shows rounded coordinates, the spreadsheet I use has the exact coordinate to 6 decimal places. The formula I have used to establish the Nearest ID as used in Q2 is as follows.

    Formula: copy to clipboard
    {=INDEX($N$2:$N$1000,MATCH(MIN(IF(O2&","&P2<>O$2:O$1000&","&P$2:P$1000,ABS(O2-O$2:O$1000)+ABS(P2-P$2:P$1000))),IF(O2&","&P2<>O$2:O$1000&","&P$2:P$1000,ABS(O2-O$2:O$1000)+ABS(P2-P$2:P$1000)),0))}


    Although it may be considered quite a complex formula I am still only learning the ropes of excel. I must acknowledge all sources that have helped me get this far but would just like the finishing touch to have it do what I need. I have considered a macro however the spreadsheet I am producing, for reasons beyond my control is required to be without a macro. Im sure that it is probably just a simple IF statement that needs to be inserted but I am not sure where and how.

    Thanks in advance!

    Kind Regards,
    Ben
    Last edited by Spicey_888; 05-08-2014 at 08:39 AM. Reason: Solved

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Return the difference between a value and it's nearest upper and lower neighbour?
    By Prince Dakkar in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-10-2013, 07:21 PM
  2. [SOLVED] Scatter Plot X Axis to the nearest point
    By vcodec in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 08-07-2012, 09:57 AM
  3. Using Large Point Type Over Two Rows
    By scotfitz in forum Excel General
    Replies: 3
    Last Post: 11-06-2010, 02:30 PM
  4. Replies: 4
    Last Post: 10-31-2010, 09:37 PM
  5. [SOLVED] Rounding to the nearest quarter point?
    By George in forum Excel General
    Replies: 3
    Last Post: 06-10-2006, 05:15 PM

Tags for this Thread

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