+ Reply to Thread
Results 1 to 4 of 4

Find nearest match in range

  1. #1
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Find nearest match in range

    I'm using this macro to try and find the row which matches 3 criteria.
    In the example given, in Column A and B there is an exact match available. In Column C, there is no exact match and a "closest" match is required.
    By "closest" I mean, the next option alphabetically.

    Is there a function similar to "WorksheetFunction.Match" which would do this?
    Or is something required to compare strings character by character?


    Untitled.png



    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Find nearest match in range

    WorksheetFunction.Match will indeed do this. Use a third argument of 1 instead of 0. But your data has to be sorted alphabetically.

    If your data is not sorted, then you will have to write the matching logic yourself.

  3. #3
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Find nearest match in range

    Yes you're right. Thanks for that.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Find nearest match in range

    No worries, and thanks for the rep!

+ 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. Match to nearest in range, then return value of a different cell.
    By LiamHH in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 10
    Last Post: 05-29-2020, 07:28 AM
  2. [SOLVED] Find nearest date in excel Index Match for two column
    By hkbhansali in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-29-2019, 05:43 AM
  3. FInd closest/nearest match in excel
    By Ribband in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-20-2018, 09:39 AM
  4. Find the nearest date in a range of dates formula
    By kaytoc in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 10
    Last Post: 10-20-2017, 04:51 PM
  5. Find the nearest date in a range of dates formula
    By kaytoc in forum Excel General
    Replies: 9
    Last Post: 10-20-2017, 03:24 PM
  6. [SOLVED] INDEX MATCH - Find Nearest Value
    By JonesZoid in forum Excel General
    Replies: 5
    Last Post: 07-23-2012, 05:48 AM
  7. Find nearest value from data range
    By vwdevotee in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-04-2010, 11:53 AM

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