VLOOKUP if all matches are the same

Abgar

Active Member
Joined
Jun 20, 2009
Messages
262
Hi All,
Hoping there's some really smart people out there that can help with what I need.
I'm trying to do VLOOKUPS from one sheet to another. Very easy, when there's only 1 match. Unfortunately, I have lots of matches.
I'd like to (if possible) have some sort of check that checks all matches in a VLOOKUP, and if they're all the same (or all the same but some are blank), return the value. If they're NOT all the same, return some sort of flag to make me manually check it. (you'll note that John returns Smith, because all are the same except for the blank one. Whereas Peter returns CHECK because one of the surnames does not match at all).
An example of my hopeful outcome is below, with the cells highlighted in yellow being the expected outcome.
In essence, the yellow cells would each be a Vlookup that searches for the first name, and if all the last names are the same, it returns that last name. If not, it returns a CHECK (this is arbitrary, it can be anything, so long as it's easily identifiable that manual checking is required).

Client_Final with ZCRM.csv
AB
1JohnSmith
2PaulCHECK
3CraigSimons
4Carly
5PeterHolmes
6
7
8JohnSmith
9JohnSmith
10JohnSmith
11John
12PaulJones
13PaulPeters
14PaulJones
15CraigSimons
16Carly
17PeterHolmes
18PeterHolmes
Sheet2




Cheers,
ABGar
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

mrshl9898

Well-known Member
Joined
Feb 6, 2012
Messages
1,951
Try =SUBSTITUTE(IF(COUNTIFS($A$8:$A$18,A1,$B$8:$B$18,VLOOKUP(A1,$A$8:$B$18,2,0))+COUNTIFS($A$8:$A$18,A1,$B$8:$B$18,"")=COUNTIF($A$8:$A$18,A1),VLOOKUP(A1,$A$8:$B$18,2,0),"CHECK"),0,"")
 

Abgar

Active Member
Joined
Jun 20, 2009
Messages
262
Holy crap - i have no idea what that even means, but it seems to work, lol. Thanks very much :)
 

Forum statistics

Threads
1,141,474
Messages
5,706,597
Members
421,459
Latest member
drewber

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
Top