Nested If Statements (Multiple)

Excel2021

New Member
Joined
Mar 26, 2021
Messages
46
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am having issues getting a complex IF statement working. I have three sheets: "Summary", "Filtered COGS Data" & "Filtered Sales Data". To simplify assume That the "Summary" sheet has 2 columns named "Identifier" and "Customer/Vendor" (Columns A-B) and the other sheets have 3 columns named "Identifier", "Customer" and "Vendor" in columns A-C. The data in these columns are stored from A2:B9 (Headers A1-B1) on the "Summary" and A2:C9 (Headers A1-C1) on the other sheets. I am trying to use IF statements and Xlookups from the "Summary" sheet to both the "Filtered COGS Data" & "Filtered Sales Data" using the "Identifier columns on each sheet (Lookup value will be the identifier column on the summary sheet). The customer or vendor can appear in 1 of the 4 columns across the "Filtered COGS Data" & "Filtered Sales Data" sheets depending on the ERP system data. I am trying to pull whichever column has this into the "Customer/Vendor" column on the summary sheet by eliminating the remaining columns using checks to ensure they <> "" or <>0. My formula which does not work is as follows:

=IF($A2="","",
IF(IF(AND(XLOOKUP($A2,'Filtered COGS Data'!$A$2:$A$9,'Filtered COGS Data'!$B$2:$B$9,0,0,1)<>0,XLOOKUP($A2,'Filtered COGS Data'!$A$2:$A$9,'Filtered COGS Data'!$B$2:$B$9,0,0,1)<>""),XLOOKUP($A2,'Filtered COGS Data'!$A$2:$A$9,'Filtered COGS Data'!$B$2:$B$9,0,0,1),
IF(IF(AND(XLOOKUP($A2,'Filtered Sales Data'!$A$2:$A$9,'Filtered Sales Data'!$B$2:$B$9,0,0,1)<>0,XLOOKUP($A2,'Filtered Sales Data'!$A$2:$A$9,'Filtered Sales Data'!$B$2:$B$9,0,0,1)<>""),XLOOKUP($A2,'Filtered Sales Data'!$A$2:$A$9,'Filtered Sales Data'!$B$2:$B$9,0,0,1),
IF(IF(AND(XLOOKUP($A2,'Filtered Sales Data'!$A$2:$A$9,'Filtered Sales Data'!$C$2:$C$9,0,0,1)<>0,XLOOKUP($A2,'Filtered Sales Data'!$A$2:$A$9,'Filtered Sales Data'!$C$2:$C$9,0,0,1)<>""),XLOOKUP($A2,'Filtered Sales Data'!$A$2:$A$9,'Filtered Sales Data'!$C$2:$C$9,0,0,1),
IF(IF(AND(XLOOKUP($A2,'Filtered COGS Data'!$A$2:$A$9,'Filtered COGS Data'!$C$2:$C$9,0,0,1)<>0,XLOOKUP($A2,'Filtered COGS Data'!$A$2:$A$9,'Filtered COGS Data'!$C$2:$C$9,0,0,1)<>""),XLOOKUP($A2,'Filtered COGS Data'!$A$2:$A$9,'Filtered COGS Data'!$C$2:$C$9,0,0,1),"")))))))))

Thanks
 

Attachments

  • Summary Sheet Excel.PNG
    Summary Sheet Excel.PNG
    41.3 KB · Views: 4
  • Filtered COGS Sheet Excel.PNG
    Filtered COGS Sheet Excel.PNG
    34.1 KB · Views: 5
  • Filtered Sales Sheet Excel.PNG
    Filtered Sales Sheet Excel.PNG
    31.6 KB · Views: 5

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,224,814
Messages
6,181,124
Members
453,021
Latest member
Justyna P

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