Identifying and highlighting non-matching text across 2 columns

Ali_G999

New Member
Joined
Jan 9, 2015
Messages
3
Hope you can help a first time poster (self taught at Excel).

I am working in Excel 2007 and have data in 2 columns (approx. 70000 rows) which contains details of 500 current & historical: Employee No., Role, Name & Office
I have cleansed, trimmed and matched so I know which rows do not match. However I need to be able to highlight the exact text which doesn't match ideally in bold and colour. For e.g. all text matches except Office which I can then record in a further column.

Is there a way to do this?

I cannot use text to columns as it would be extremely time consuming and the formatting of the names whilst consistent across the columns includes forenames, middle names, surnames including Mc, McRae, Mac Rae, Mc Rae would invovle a lot of reformatting/concatenation etc of the new columns.

I have a feeling that I need a formula to use in conjunction with conditional formatting but I have looked everywhere and can't see a formula I could use.

This is my last hope of trying to get it sorted :(
 
Last edited:

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Welcome to the forum

Can we have SAMPLE data showing how the data is now and what your expected RESULT should look like?
 
Upvote 0
Apologies but I cant see how to attach a file? I've tried to screenshot an example data set it but it won't let me attach as its not an image
 
Upvote 0
Apologies but I cant see how to attach a file? I've tried to screenshot an example data set it but it won't let me attach as its not an image
unfortunately, you cant attach files here. What you can do though is to upload it to dropbox or google docs and paste a link here for whoever needs to access, making sure you modify the access rights appropriately
 
Upvote 0
Unfortunately I won't be allowed to do that but a sample of what the data looks like and what I'm hoping to achieve would look like this but with the bold text also highlighted in colour

Previous Data
Current Data
Matched
0145325 Clerk John Murphy Wingford
0145325 Clerk John Murphy Wingford
Yes
156346 Analyst Joseph McDonald HQ
156346 Manager Joseph McDonald HQ
No
2534468 Officer Alison Keyes Springfield
2534468 Officer Alison Keyes Stoke
No
178596 Admin Jane Doe HQ
178596 Clerk Jane Doe Metro
No
0145325 Clerk John Murphy Wingford
0145325 Clerk John Murphy Wingford
Yes

<tbody>
</tbody>
 
Last edited:
Upvote 0
Please try this code on a COPY of the data and maybe not the 70,000 rows. you could copy a section and run the code on it
Code:
Sub HighlightMissingWord()    Dim Ask, I As Integer, Pos As Integer, J As Integer    For I = 2 To Range("A" & Rows.Count).End(xlUp).Row        If Range("A" & I).Value <> Range("B" & I).Value Then            Ask = Split(Range("B" & I).Value, " ")            For J = 0 To UBound(Ask)                On Error Resume Next                If InStr(1, Range("A" & I), Ask(J)) = 0 Then                    Pos = InStr(Range("B" & I), Ask(J))                    With Range("B" & I).Characters(Pos, Len(Ask(J)))                        .Font.Bold = True                        .Font.Color = vbRed                    End With                End If            Next J        End If    Next IEnd Sub
 
Upvote 0
Unfortunately I won't be allowed to do that but a sample of what the data looks like and what I'm hoping to achieve would look like this but with the bold text also highlighted in colour
I hope the code pastes better this timeN.B: Can't get the code to paste as desired
 
Last edited:
Upvote 0
The code should look like this
Code:
Sub HighlightMissingWord()
    Dim Ask, I As Long, Pos As Integer, J As Integer
        
    For I = 2 To Range("A" & Rows.Count).End(xlUp).Row
        If Range("A" & I).Value <> Range("B" & I).Value Then
            Ask = Split(Range("B" & I).Value, " ")
            For J = 0 To UBound(Ask)
                On Error Resume Next
                If InStr(1, Range("A" & I), Ask(J)) = 0 Then
                    Pos = InStr(Range("B" & I), Ask(J))
                    With Range("B" & I).Characters(Pos, Len(Ask(J)))
                        .Font.Bold = True
                        .Font.Color = vbRed
                    End With
                End If
            Next J
        End If
    Next I
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,308
Messages
6,124,173
Members
449,146
Latest member
el_gazar

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