+ Reply to Thread
Results 1 to 5 of 5

VBA Fuzzy Lookup (Find) - Case Sensitive Issue

  1. #1
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    VBA Fuzzy Lookup (Find) - Case Sensitive Issue

    Hi,

    I have a function that performs a "fuzzy" lookup/find against a set of data to find matching values.

    For example, for each cell in Field 1, the value in that cell is looked up against the entire range of data in Field 2,
    and where there is a "Fuzzy" Find/match, that value is populated on the same row in the column named "FUZZY FIND".
    I have a separate function that calculates a similarity score in column D.

    To illustrate this: Cell A2 = the number 123, well, 123 also exists in Field2 (B5), so on Cell C2 (FUZZY FIND column), the value 123 appears which is a 100% match.


    FIELD1 FIELD2 FUZZY FIND SIMILARITY SCORE
    123 this is pretty awesome 123 100%
    7899 UPPERCASE 789 75%
    hello hell hell 80%
    this is awesome 123 this is pretty awesome 68%
    ALEX 789 ALEX 100%
    uppercase karl 0%
    alex ALEX 0%



    The problem I am running into however is that my FuzzyFind function is case sensitive, whereas I would like it to ignore the case -- or perhaps consider all of the data to be upper or lower case, if that's the easier solution.

    For example, in cell A6 I have the name "ALEX" appear, which also appears in Field 2 exactly as "ALEX", so in cell C6, the corresponding Fuzzy Find = "ALEX", which is rated as a 100% match.

    However, in cell A8, the name "alex" appears as lower case, of which there is no lowercase variant in Column 2, so in cell C8, my Fuzzy Find value is simply blank, with a 0% match rate.
    Rather, I would like "alex" and "ALEX" to both be treated equally, and correspond to a 100% match, so my "FUZZY FIND" value for "alex" should appear as "ALEX" in cell C8, instead of the blank currently there.

    I've played around with the code in the function used to generate the values in Col C, but can't figure out a way to get it to either ignore case or normalize the case (all UPPER or lower) against both columns being evaluated.

    I've attached a sample file with the same table as above (on Sheet2) that I hope someone can take a look at, and lend a helping hand.

    Oh, and here's my code for the FuzzyFind Function that's used to generate the values in Col C:
    Please Login or Register  to view this content.
    Thanks in advance!
    Attached Files Attached Files
    Last edited by hamidxa; 07-20-2017 at 08:32 PM.

  2. #2
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,347

    Re: VBA Fuzzy Lookup (Find) - Case Sensitive Issue

    maybe just put some Lcase around your variables

    Please Login or Register  to view this content.
    If you want something done right... find a forum and ask an online expert.

    Time flies like an arrow. Fruit flies like a banana.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA Fuzzy Lookup (Find) - Case Sensitive Issue

    Change all
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    883

    Re: VBA Fuzzy Lookup (Find) - Case Sensitive Issue

    If my solution worked (or not) please let me know. If your question is answered then please remember to mark it solved

    Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown

  5. #5
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: VBA Fuzzy Lookup (Find) - Case Sensitive Issue

    Thanks everyone, I was able to implement the solution(s) suggested, and it now works!

+ 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 String in given Range without utilize Array [could avoid case sensitive]
    By alexnkc in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-01-2017, 07:20 AM
  2. [SOLVED] Case Sensitive issue
    By dustinshaw in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-15-2016, 04:55 PM
  3. Replies: 1
    Last Post: 08-24-2015, 10:42 AM
  4. [SOLVED] Find word(s) within text string that matches a list of keywords - NOT case sensitive
    By gbm222 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-06-2013, 02:15 AM
  5. [SOLVED] How does this Case Sensitive Lookup Work using 1/Exact?
    By Trevasaurus in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-06-2013, 04:05 PM
  6. [SOLVED] Performing Case-sensitive Lookup, please explain how this code works
    By Dwexdwex in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-27-2013, 09:30 AM
  7. [SOLVED] SUMPRODUCT Or SUMIF - In case of Case sensitive???
    By lifeisaspreadsheet in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-28-2012, 07:57 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