Combining VLOOKUP with removing/blanking the result if it is a duplicate of another cell in the same row

Surreybloke

Board Regular
Joined
Apr 1, 2010
Messages
164
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm trying to work out the best way to deal with the issue I've referred to in the subject. I have rows of data where we have one cell where a rep name comes through from the data. We then have another cell where another name should be added based on other criteria, but sometimes it pulls through the same name (correctly) however, I don't want that name to come through for a second time. The VLOOKUP needs to stay in place, but I could do with some help on how to build into that formula, how to exclude it if it matches the name in the other cell on that row.

Thanks,
Surreybloke

I'm using Office 365 and an up to date version of Excel
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Could you please post a sample of your data (e.g. 10 rows) including the desired outcome?
 
Upvote 0
Could you please post a sample of your data (e.g. 10 rows) including the desired outcome?
Employee IDRep_Name_1Split Amount (%)Employee IDRep_Name_2Split Amount (%)Employee IDRep_Name_3
210261564JOE BLOGGS
100​
210210140​
BIG BOSS
210261564JOE BLOGGS
100​
210210140​
BIG BOSS
210213461MRS MIGGINS
100​
210210140​
BIG BOSS
210261564TIMOTHY CLAYPOLE
100​
210210140​
BIG BOSS
210261564TIMOTHY CLAYPOLE
100​
210210140​
BIG BOSS
210261564TIMOTHY CLAYPOLE
100​
210210140​
BIG BOSS
210210140BIG BOSS
100​
210210140​
BIG BOSS
210210140BIG BOSS
100​
210210140​
BIG BOSS
210261331HAZEL MCWITCH
100​
210210140​
BIG BOSS
210210140BIG BOSS
100​
210210140​
BIG BOSS

As you can see, there are some duplicates in names between rep name 1 and rep name 3 and it's in rep name 3 where I want it to return a blank if it is the same name.
 
Upvote 0
Hello, if I understand it correctly you could wrap the current formula into IF function:

IF(VLOOKUP=B2,"",VLOOKUP)

where VLOOKUP represents the VLOOKUP formula that you are using and B2 refers to the "Rep_Name_1" column (i.e. JOE BLOGGS).
 
Upvote 0
Hello, if I understand it correctly you could wrap the current formula into IF function:

IF(VLOOKUP=B2,"",VLOOKUP)

where VLOOKUP represents the VLOOKUP formula that you are using and B2 refers to the "Rep_Name_1" column (i.e. JOE BLOGGS).
=UPPER(IF(ISERROR(VLOOKUP(AU1033,'Global Remits'!A:A,1,0)),"",VLOOKUP(AU1033,'Global Remits'!A:B,2,0)))

This is the existing formula in the rep name 3 column. I get the too many arguments error trying to incorporate the additional formula.
 
Upvote 0
Something like this then maybe?

Excel Formula:
LET(
a,XLOOKUP(AU1033,'Global Remits'!A:A,'Global Remits'!B:B,""),
IF(a=AP1033,"",a)
 
Upvote 0
Something like this then maybe?

Excel Formula:
LET(
a,XLOOKUP(AU1033,'Global Remits'!A:A,'Global Remits'!B:B,""),
IF(a=AP1033,"",a)
Hi, thanks for writing back. Where you have AP1033 in the final part of the formula, is that meant to relate to the rep name 1 field? To add further information which I didn't have time to do yesterday, the lookup to the Global Remits tab, using AU in the formula above, is looking up a product name to a lookup list on the Global Remits tab. It then populates rep name 3 with the name of the person assigned to that product.

Accordingly, I have changed the reference AP1033 to be T1033, which itself has a formula in (a VLOOKUP) to retrieve the correct name for that line. Is the fact that column T has a formula in what is causing your suggestion above to not pull through the name if I change the name in column T? Currently, a blank value is returned regardless of whether the names match or not.
 
Upvote 0
Sorry, I had no clue how the data is structured. The original suggestion was to test whatever is returned in "Rep_Name_3" column against "Rep_Name_1", i.e. IF Rep_Name_3 = Rep_Name_1 then "", otherwise Rep_Name_3. If it is a VLOOKUP formula in Rep_Name_3 then wrap it up into IF statement. Or do I not understand it correctly?
 
Upvote 0
Sorry, I had no clue how the data is structured. The original suggestion was to test whatever is returned in "Rep_Name_3" column against "Rep_Name_1", i.e. IF Rep_Name_3 = Rep_Name_1 then "", otherwise Rep_Name_3. If it is a VLOOKUP formula in Rep_Name_3 then wrap it up into IF statement. Or do I not understand it correctly?
No worries at all, it was my fault for not being clearer, but work was so busy I didn't have the chance. I tried making some amendments to your formula yesterday but I couldn't get it to work if the names didn't match as it still produced the blank cell in rep_name_3. I'm not quite sure how to make it work with the IF statement having tried and failed yesterday with that.
 
Upvote 0
XLOOKUP has an optional argument what should be returned if nothing is found - you can change it from "" to something like "not found". Based on your data is the output you are looking for depicted below?
 

Attachments

  • O.png
    O.png
    27.8 KB · Views: 3
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,190
Members
452,616
Latest member
intern444

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