+ Reply to Thread
Results 1 to 4 of 4

Add Two More Criteria to Index Match Min Formula Used For Finding Nearest Points

  1. #1
    Registered User
    Join Date
    09-03-2021
    Location
    Binghamton, NY
    MS-Off Ver
    365 ProPl
    Posts
    2

    Add Two More Criteria to Index Match Min Formula Used For Finding Nearest Points

    =INDEX('[Example1.xlsx]Utility Connectors'!C$4:C$845,MATCH(MIN(SQRT(('[Example1.xlsx]Utility Connectors'!D$4:D$845-D3)^2+('[Example1.xlsx]Utility Connectors'!E$4:E$845-E3)^2)),SQRT(('[Example1.xlsx]Utility Connectors'!D$4:D$845-D3)^2+('[Example1.xlsx]Utility Connectors'!E$4:E$845-E3)^2),0),1)

    This finds and enters the name of the building utility valve that is closest to the machine that needs this service connection.

    I need to add two more criteria to the above formula (found in column F of the Machine Connections tab) so that the answer is a valve of the correct utility type instead of the nearest valve without regard to utility type, as it is now. The second need is to distinguish one floor level from the other since the machines and services exist on two floors.

    I've tried many things but can't figure it out. Need to add something like MATCH(C7,A$4:A$22) or ,(A$4:A$22=C7) or +(A$4:A$22=C7) . The type of statement and nomenclature that is compatible with the existing MIN statement is what has me stumped.

    Thank you.
    Attached Files Attached Files

  2. #2
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Add Two More Criteria to Index Match Min Formula Used For Finding Nearest Points

    one option might be to add a large number wherever either Floor or Utility do not match thereby ensuring they will not be the MIN, e.g.:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    with this type of approach, if possible you may not always get a result, you should add a pre-emptive COUNTIFS test.
    Last edited by XLent; 09-04-2021 at 05:35 AM. Reason: missed the floor level, appended as OR

  3. #3
    Registered User
    Join Date
    09-03-2021
    Location
    Binghamton, NY
    MS-Off Ver
    365 ProPl
    Posts
    2

    Re: Add Two More Criteria to Index Match Min Formula Used For Finding Nearest Points

    Thank you so much! That solves 99% of my issues!
    I'll have to digest and test the COUNTIFS suggestion.
    Would you mind giving a brief description of what (10^10* is doing? Okay if you'd rather not.
    Thanks.

  4. #4
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Add Two More Criteria to Index Match Min Formula Used For Finding Nearest Points

    the logic is to add 10bn to the SQRT result wherever, either, a) the Level (A <>A3) or b) Utility (B <> C3) do not match the criteria (if neither match you will add 20bn) -- so, the invalid rows will return meaningless results in context of outer MIN calculation. However, if it's possible to not have any valid results you would still get rogue results with this approach as the MIN would be taken from one of the >10bn results, hence the pre-emptive COUNTIFS test.

    You could also adopt a slightly different approach using something like the below:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    in this instance, both the FILTER and AGGREGATE will only reference valid rows, returning #NUM! where no valid result exists (handled via IFERROR)
    the outer INDEX is just to handle possibility of FILTER returning more than 1 record (should 2 valid rows return identical SQRT)

+ 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] Finding Nearest value using Index/Match
    By JeffGrant in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-17-2021, 07:48 PM
  2. [SOLVED] Finding Difference with Index Match Multiple Criteria
    By ryoder in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-07-2020, 01:45 PM
  3. Help with Index Match formula finding last 4 occurences of the name
    By dangorka in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-20-2019, 05:20 AM
  4. [SOLVED] INDEX/MATCH generates incorrect result by referencng nearest cell if match not found
    By aglawrence in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-29-2017, 08:59 AM
  5. Index/Match Function for Finding Result in between Two Values with Two Criteria
    By KyleElliott in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-09-2017, 01:19 AM
  6. Finding the max occurence with the INDEX, MATCH and MAX formula
    By greengirl in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-06-2015, 11:37 AM
  7. Index Match with Multiple Criteria One to Nearest Date
    By burningeagle in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-16-2014, 11:59 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