ADDING LOGIC TO AN EXISTING FORMULA

meppwc

Well-known Member
Joined
May 16, 2003
Messages
634
Office Version
  1. 365
Platform
  1. Windows
For the following formula
=IFERROR(XLOOKUP(F2,Sheet2!A:A,Sheet2!B:B),"")
Currently, if the value is found in A:A, and if B:B cell is blank, the formula returns zero "0"
When zero is the result, I would like it to return "STATUS IN AL IS UNDETERMINED"

I keep trying to get that result and I am sure that my syntax is incorrect. I would greatly appreciate some assistance.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
How about:
Excel Formula:
=LET(x,IFERROR(XLOOKUP(F2,Sheet2!A:A,Sheet2!B:B),""),IF(x=0,"STATUS IN AL IS UNDETERMINED",x))
 
Upvote 0
Thanks Again Joe4...........I was going about this completely the wrong way.
 
Upvote 0
You are welcome.

I don't know if you have used the LET function before, but it is a great new function that let's you set a whole formula equal to a variable, so you can reference it more than once in your calculation without having to retype the whole thing. Really useful in cases like these!

Here is more about it: LET function - Microsoft Support
 
Upvote 0
I took good notes from your example...........I am sure I will be using LET in the future
 
Upvote 0
Hi Joe4
Recently you assisted me (see above), with an alternative for "0" if cell B:B is blank. ("STATUS IN AL IS UNDETERMINED")
What if I want additional logic if either B:B or A:A is blank
If A:A is blank, then "VALUE SEARCHED ON NOT FOUND"
 
Upvote 0
You just need to update the XLOOKUP portion of the formula, as it has an option of what to return if no matching value is found.
(See: XLOOKUP function - Microsoft Support)

You are already telling it to return "", so you would just then need to change that part of the formula like this:
Rich (BB code):
=LET(x,IFERROR(XLOOKUP(F2,Sheet2!A:A,Sheet2!B:B),"VALUE SEARCHED ON NOT FOUND"),IF(x=0,"STATUS IN AL IS UNDETERMINED",x))
 
Upvote 0
Solution
oh.........that was very obvious.........sorry for the bother, but appreciate your help once again.
 
Upvote 0

Forum statistics

Threads
1,225,635
Messages
6,186,128
Members
453,340
Latest member
Stu61

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