Nested IF with XLOOKUP formula

janema

Board Regular
Joined
Nov 28, 2022
Messages
143
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2011
  5. 2010
Platform
  1. Windows
  2. Mobile
I am trying to get this formula to return BLANK if cell AS2 is blank, and if the first XLOOKUP is Blank or no data, to use the second XLOOKUP, otherwise keep the first XLOOKUP. For some reason, it is only working with the first XLOOKUP. Can someone please help me figure out why the formula isn't working? Thank you so much in advance! ❤️

The formula is currently written as follow and shown below:

=IF(AS2="","",IF(XLOOKUP(AS2,'LS 4.2024'!L:L,'LS 4.2024'!P:P)="",XLOOKUP(AS2,'All US 4.2024'!L:L,'All US 4.2024'!P:P),XLOOKUP(AS2,'LS 4.2024'!L:L,'LS 4.2024'!P:P)))

1722279166484.png
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
If a value to be returned via XLOOKUP search is blank, XLOOKUP will return it as 0; so, instead of ="" you need to wrap the whole XLOOKUP into ISBLANK function, i.e.

IF(ISBLANK(XLOOKUP(AS2,'LS 4.2024'!L:L,'LS 4.2024'!P:P)...
 
Upvote 0
That formula should work. Can you post some of the data from the LS 4.2024 sheet.
 
Upvote 0
If a value to be returned via XLOOKUP search is blank, XLOOKUP will return it as 0; so, instead of ="" you need to wrap the whole XLOOKUP into ISBLANK function, i.e.

IF(ISBLANK(XLOOKUP(AS2,'LS 4.2024'!L:L,'LS 4.2024'!P:P)...

Like so?

=IF(AS2="","",IF(ISBLANK(XLOOKUP(AS2,'LS 4.2024'!L:L,'LS 4.2024'!P:P)="",IF(ISBLANK(XLOOKUP(AS2,'All US 4.2024'!L:L,'All US 4.2024'!P:P),XLOOKUP(AS2,'LS 4.2024'!L:L,'LS 4.2024'!P:P)))
 
Upvote 0
There is no need to use isblank, especially as it may not work.
 
Upvote 1
That formula should work. Can you post some of the data from the LS 4.2024 sheet.
Sure. Here is an example:

The data does NOT exist in the LS 4.2024 sheet:
1722280494288.png


But it does exist in the All US sheet:

1722280364243.png


However; it is returning a BLANK or ZERO in the formula. :(
 
Upvote 0
Can't tell much from an image, but column P is not empty. It has either a 0 (formatted to show "-"), or an "-" so you need to check for that.
 
Upvote 0
Can't tell much from an image, but column P is not empty. It has either a 0 (formatted to show "-"), or an "-" so you need to check for that.

It is empty or doesn't exist on the "LS 4.2024" file so shouldn't it then pull from the "All US" file in my formula?
 
Upvote 0
The cells in col P are NOT empty.
 
Upvote 0
The cells in col P are NOT empty.
1722282406613.png


The lookup in my example is EN.ESCA.P5, but that does not exist in the LS 4.2024 file as shown in the image so I wanted it to pull from the ALL US file. I think you mean that using IF="" is incorrect because it's not blank, it's just non-existent?
 
Upvote 0

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