IF AND STATEMENT with XLOOKUP

volsfan210000

Board Regular
Joined
Jul 24, 2007
Messages
75
I have two excel sheets with columns of data.

Sheet 1 I have column A (Data Set 1) & Column B (Data Set 2) which represent the fields I want to look for in sheet 1

Sheet 2 is the raw data and i want the if and statement to look for in Column A & Column C

I want the formula to tell me if sheet 1 has the data that sheet 2 has.
 

Attachments

  • if and statment with xlookip.png
    if and statment with xlookip.png
    17.6 KB · Views: 8

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Cannot manipulate data in a picture. Please resubmit using XL2BB.
 
Upvote 0
I don't see a column C in you rexample. So I've made it up.
The #N/A means the combination was not found:

Also, this only get the first match found. So if a Projt number and CODE appear twice in Sheet2 you will only get the first record.

Book1
ABCDEFG
1Sheet1Sheet2
2
3ColAColBLOOKUPColAColBColC
4
5Projt1ABCAProjt1ABCA
6Projt2123#N/AProjt2ABCB
7Projt3456#N/AProjt3ABVC
8Projt4789#N/AProjt4123D
9Projt5ABC#N/AProjt5456E
10Projt6123#N/AProjt6789F
11Projt7456#N/AProjt7ABCG
12Projt8789#N/AProjt8ABCH
13Projt9ABCIProjt9ABCI
14Projt10123#N/AProjt10ABCJ
15Projt11456#N/AProjt11ABVK
16Projt12789#N/AProjt12123L
17Projt13ABC#N/AProjt13456M
18Projt14123#N/AProjt14789N
19Projt15456OProjt15456O
20Projt16789PProjt16789P
Sheet1
Cell Formulas
RangeFormula
C5:C20C5=INDEX(G5:G20,MATCH(A5&B5,E5:E20&F5:F20,0))
 
Upvote 0
If you have more than one match per item in the first table, then you can gather all matches using Power Query

Power Query:
let
    T1= Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    RemoveNull = Table.SelectRows(T1, each [ColA] <> null),
    T2= Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    RemoveNulls = Table.SelectRows(T2, each ([ColA] <> null)),
    Join= Table.NestedJoin(RemoveNull,{"ColA","ColB"},RemoveNulls,{"ColA","ColB"},"T3",JoinKind.LeftOuter),
    ExpandedT3 = Table.ExpandTableColumn(Join, "T3", {"ColC"}, {"ColC"})
in
    ExpandedT3
 
Upvote 0

Forum statistics

Threads
1,221,544
Messages
6,160,438
Members
451,646
Latest member
mmix803

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