VBA to Compare two sheets if one contains same data

henry_90lx

New Member
Joined
Nov 11, 2008
Messages
2
Been coming here for a long time to get all my excel help, never have had to post before as every question I have had has already been answered in a post, that is up untill now.

Have:

Sheet1, column B starting on line 2 and going to line 8500 = Last, First Middle (all in one cell)

Sheet2, column A starting on Line 1 and going to about line 500 = Last (in one cell)

What I need to do is take all the last names on Sheet2 and compare them to all the names on Sheet1.

If the Last name I have on sheet2 matches a last name on sheet1 then I need it to be flagged on Sheet1 some how (Line highlated or text turned red)

The soultion I had found that did not work were do to the comparison looking for exact match. i.e. Sheet1 had the Name: Smith, Bob J and Sheet2 had the name: Smith it would not return it as match, do the the cells not being exact. I would need this example to return as a match.

As always thanks for the help.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Conditional formatting would be ideal, but can't be used across sheets. If you can copy and paste the last names form Sheet2 into a helper column in Sheet1 then you could use the following CF on the range B2:B8500 on Sheet1:
Code:
=ISNUMBER(MATCH(LEFT(B2,SEARCH(",",B2)-1),$C$1:$C$500,0))
Here I've assumed that you inserted a new column (C) after the list in column B of Sheet1. You can set the CF, for example to fill all matching cells with a color.
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,879
Members
452,948
Latest member
Dupuhini

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