View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Martin Brown Martin Brown is offline
external usenet poster
 
Posts: 230
Default Similar Function in VBA - does it exist ?

christopher ward wrote:
Dear Experts

I have a need to compare 2 data items - Var1 and Var2 which are both strings

Var1 may have "Aston Martin" within it and Var2 may have "Asto Martin" - i.e
they are similar and a user has spelt Var2 incorrectly.

I need to evaluate them so I can see in a long list they are the same - has
VBA a function which compares Is Similar or has any one an idea how this may
be done


A crude method that *will* give false positives is to sort the string
into alphabetical order. Then apply the Like match suggested earlier. It
is more often used for anagrams and crossword solvers.

This will get transposed letters and single typos extra or missing. You
could probably ignore non-alphanumerics too.

Regards,
Martin Brown