XLookup and IF formula

Aewilliams

New Member
Joined
Oct 24, 2024
Messages
4
Office Version
  1. Prefer Not To Say
I have two worksheets and am trying to use a formula to populate a column looking at information on both. Any help would be much appreciated.....

Tab 1
Column A contains a Ref and Column B contains a tag in the form of a colour, either Black or Red
Each reference can be tagged as black, red or black and red (for black and red there would be more than one row for the reference e.g. a row showing it tagged as black and another row showing it tagged as red e.g.)

View attachment 118498

Tab 2
I want to add a formula to columns B, C and D to look at the ref in tab 2, find that ref in tab 1 and if the ref is tagged as Red then it will return a Yes in column B. If that ref also appears on Tab 1 with a Black tag, I want a Yes to show in column C. I tried an XLookup and a VLookup but can't get either to work.

1729786132455.png
 

Attachments

  • 1729786013560.png
    1729786013560.png
    7 KB · Views: 4

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
What about col D?

Wit the following data, what results do you expect to see on tab 2?
Book1
AB
1RefTag
21Black
33Red
42Red
54Red
64Black
72Black
Sheet1
 
Upvote 0
Perhaps something like:

Excel Formula:
=IF(COUNTIFS(Tab1!$A:$A,$A2,Tab1!$B:$B,B$1),"Yes","No")

in B2, then copy across to C2, and fill both down.

Then in D2:

Excel Formula:
=IF(AND(B2="Yes",C2="Yes"),"Yes","No")

Unless you want only one Yes per row.
 
Upvote 0

Forum statistics

Threads
1,224,879
Messages
6,181,530
Members
453,054
Latest member
ezzat

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