Compare data within same cell

Psyanide

New Member
Joined
May 5, 2016
Messages
8
I require a macro code which compares data within same cell and accordingly provides status either "match found" or "mismatch"
I work on a discrepancy report and most of the property addresses are same only difference is abbreviations
eg. street = st, Road = rd and so on.

In the below example data on left side of "|||" is from 1 source and data on right side of "|||" is from other source
In the below example "A2" and "A3" are good to be deleted however "A4" has "drive" against "avenue" hence it needs to be verified.
Can you please provide me a macro code which would give me output as presented in "B" column based on the data on column "A"

Note: There are many such abbreviations I come across which I will add in the code by myself once I have the basic code.


AB
1Property AddressMacro result
2Apple Street ||| Apple StDelete
3Blue Road colony ||| Blue Rd colonyDelete
4Sunshine Drive ||| Sunshine AvenueCheck

<colgroup><col><col><col></colgroup><tbody>
</tbody>


Thanks :)
 
Within the For Loop, just put an if statement to check if the current cell's value is blank. Something like this:

Code:
For currRow = 1 To maxRow
        address = Cells(currRow, 1).Value
        If address = "" or address = " " Then
           'Whatever you want to do with blank cells, if you just want to ignore them, leave this as is
        Else
        add1 = address1(address)
        add2 = address2(address)
        If replaceAll(LCase(add1)) = replaceAll(LCase(add2)) Then
            Cells(currRow, 2).Value = "Delete"
        Else
            Cells(currRow, 2).Value = "Verify"
        End If
       End If
    Next
 
Upvote 0

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,216,086
Messages
6,128,736
Members
449,466
Latest member
Peter Juhnke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top