+ Reply to Thread
Results 1 to 3 of 3

Check if substring exists in string and allow a difference of 1 character

  1. #1
    Registered User
    Join Date
    02-12-2020
    Location
    Amsterdam
    MS-Off Ver
    10
    Posts
    4

    Check if substring exists in string and allow a difference of 1 character

    Hello all,

    I compare 2 cells to find out of their contents are equal:

    Please Login or Register  to view this content.
    However my list contains a lot of entries that are more or less the same except for 1 or 2 characters.
    Is there a way to include these small variations.

    Take the following as an example:

    Corrosive solid, n.o.s.
    Corrosive solids, n.o.s.

    or

    Hydrofluoric acid and sulphuric acid mixture
    Hydrofluoric acid and sulfuric acid mixture

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Check if substring exists in string and allow a difference of 1 character

    A couple of functions for you, Similarity and Fuzziness:

    Please Login or Register  to view this content.
    Similarity will return the number of characters different between two strings. Fuzziness will return a percentage score based on the similarity. You could therefore try something like:

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.
    Would that work for you?

    WBD
    Office 365 on Windows 11, looking for rep!

  3. #3
    Registered User
    Join Date
    02-12-2020
    Location
    Amsterdam
    MS-Off Ver
    10
    Posts
    4

    Re: Check if substring exists in string and allow a difference of 1 character

    This might work. I'll give it a try.
    Thanks WBD!

+ 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. VBA Check of string exists in an Array
    By mchilapur in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-04-2016, 10:30 AM
  2. check to see if the first character in a string is a comma
    By pablowilks in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-19-2012, 03:52 PM
  3. How to check if a string in a cell contains a substring?
    By pablowilks in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-06-2012, 04:14 PM
  4. Check if a string begins with substring and then change text
    By booo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-16-2010, 03:39 PM
  5. Checking to see if a character exists in a string
    By WKM in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 06-04-2010, 11:59 PM
  6. Replies: 3
    Last Post: 02-02-2006, 01:45 PM
  7. check substring of a string in Excel VBA
    By magix in forum Excel General
    Replies: 2
    Last Post: 12-11-2005, 11:10 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