+ Reply to Thread
Results 1 to 6 of 6

FInd closest/nearest match in excel

  1. #1
    Registered User
    Join Date
    05-04-2017
    Location
    Scotland
    MS-Off Ver
    2007
    Posts
    47

    FInd closest/nearest match in excel

    Hi All
    I'm using a formula to look up a person and find the location of that person in another tab =IF(B2=0,"",VLOOKUP(B2,CHOOSE({1,2},'EMP OFF'!E:E,'EMP OFF'!A:A),2,0)) this works fine where the name is entered correctly.
    Where it fails, is that if I do not enter an exact match it returns N/A. What I would like is a formula in another cell, F4, to offer a close match or alternative nearest match, i.e. if I put in a name spelt slightly incorrectly (e.g. search for Joo Bloggs then the closest match should offer me Joe Bloggs) or it can offer a nearest match (e.g. can't find Joe Bloggs but found Bob Bloggs). The formula I'm using is =VLOOKUP(B2,Table135[[FORENAME]:[COMMENTS]],3,TRUE) but all it offers is a name seemingly picked at random and nowhere near the spelling of the name entered.

    Can anyone help?

  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,720

    Re: FInd closest/nearest match in excel

    To get the closest match with TRUE the names have to be sorted, in ascending order. Are your names sorted?

    Also, by "closest match" it will find the closest entry in the sorted order. If you search for Fred Smyth it should be able to find Fred Smythe. It will not be able to search for Joe Bloggs and find Bob Bloggs. That is a actually a pretty complicated problem.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    05-04-2017
    Location
    Scotland
    MS-Off Ver
    2007
    Posts
    47

    Re: FInd closest/nearest match in excel

    Hi Jeff

    All names are sorted A to Z

    I would settle for if could do that but if I misspell a name it returns a name which is totally different than was entered.

  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,720

    Re: FInd closest/nearest match in excel

    Please show an example with the following:

    The name you use to search

    The actual "closest" name in your data that you want it to match, and its row number
    The two names before and two names after that name in your list

    The name that it is actually returning, and its row number
    The two names before and two names after that name in your list

    It would be better to just attach the file but I'm guessing it has private data.

  5. #5
    Registered User
    Join Date
    05-04-2017
    Location
    Scotland
    MS-Off Ver
    2007
    Posts
    47

    Re: FInd closest/nearest match in excel

    Hi

    The results vary depending on the letter omission or change of letter in the name, it seems to go where it wills, It is not even close to a match. Only if correct, does it returns the correct row to the name.

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

    Re: FInd closest/nearest match in excel

    I can't help without data.

+ 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] Find address of closest match/second closest match
    By L.LEE in forum Excel General
    Replies: 1
    Last Post: 11-13-2018, 11:56 PM
  2. Match or fix to nearest/closest lower value.
    By nihar sharma in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-16-2015, 11:59 AM
  3. Match or fix to nearest/closest greater value.
    By nihar sharma in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-15-2015, 02:52 AM
  4. Find the closest time match
    By VBAasdf in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-06-2015, 12:20 PM
  5. How to find the closest match meeting conditions
    By glenn37475474 in forum Excel General
    Replies: 2
    Last Post: 06-28-2011, 02:44 AM
  6. find closest match to a given value
    By Grimace in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-21-2009, 09:25 PM
  7. Using VLookup to find closest match
    By mtrant in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-12-2008, 02:08 PM

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