1

I need to check for some minor spelling changes in cells. How can I compare two cell values and get an almost equal values. Say If there is only a character missing like "jordan120" and "jordn120". How can I get these values using macro? I have two case scenarios for exact match and almost match.

I have tried vlookup function and find method.

Sub Changes()
Dim chang, currentdest, presource As Worksheet
Dim precount, currentcount, prelstrow, currentlstrow, rowno, rownow, rownow1 As Integer
Dim somstrng, somstrng1, predept, currentdept, pregrade, currentgrade, convertion As String
Dim table5, cellfound As Range
Set chang = ActiveWorkbook.Sheets("Change")
Set presource = ActiveWorkbook.Sheets("Previous")
Set currentdest = ActiveWorkbook.Sheets("Current")
precds = presource.Range("A" & precount).Value
     rownow = .Columns("A:A").Find(What:=precds, After:=ActiveCell, LookIn:=xlValues, _
            LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
            MatchCase:=True, SearchFormat:=True).Row

and vlookup

Set table5 = currentdest.Range("A:C")
With chang
        falsval = Application.VLookup(precds, table5, 1, True)
        End With

They didn't help me.

Community
  • 1
  • 1
srt
  • 521
  • 3
  • 11
  • 22
  • 2
    Excel has no built-in support for "fuzzy matching" Maybe try: https://www.microsoft.com/en-us/download/details.aspx?id=15011 – Tim Williams Dec 21 '15 at 18:46
  • Have you read about Soundex, metaphone, match rating approach? – MattClarke Dec 21 '15 at 22:22
  • 1
    See also https://en.wikipedia.org/wiki/Approximate_string_matching and http://stackoverflow.com/questions/5859561/getting-the-closest-string-match – MattClarke Dec 21 '15 at 22:24

0 Answers0