IFERROR returns zero but that 0 doesn't work with conditional formatting

nathp

New Member
Joined
Apr 25, 2023
Messages
20
Office Version
  1. 365
Platform
  1. Windows
Firstly please excuse me if this is a stupid questions as I relatively inexperienced with excel.

I have an IFERROR formula that preceeds an xlookup. This is set to return a value from the xlookup and a 0 if no value is present in the lookup. I then want to format this cell (along with others) conditionally so that 0 values turn green, 1-2 turns yellow etc). The conditional formatting works perfectly if there is a zero found in the xlookup (or any other number) but when a zero is returned by the iferror then that zero acts as a high number. For instance formatting the returned 0 as a greater than 10 value colours the 0 cell.

Sorry for the bad explanation but any help would be much appreciated.

Thanks
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hi & welcome to MrExcel.
What is the formula you are using?
 
Upvote 0
Hi & welcome to MrExcel.
What is the formula you are using?
Thanks for the welcome.
This is the formula
=IFERROR(XLOOKUP("S23P2_ELD1",Alarms!$A$19:$A$43,Alarms!$B$19:$B$43),"0")
 
Upvote 0
You need to remove the quotes from the "0" other wise it's text & not a number.
 
Upvote 0
Solution
Can you please share your formula? Because, depending on how the IFERROR is employed, it might not be necessary because the XLOOKUP function has a parameter to specify what to display if no match is found on the lookup range.

In my example formula below, the second zero represents what to return if there is no match.

Excel Formula:
=XLOOKUP("Vader",F1:F3,G1:G3,0,0)
 

Attachments

  • 1682436163317.png
    1682436163317.png
    7.2 KB · Views: 9
Upvote 0
Can you please share your formula? Because, depending on how the IFERROR is employed, it might not be necessary because the XLOOKUP function has a parameter to specify what to display if no match is found on the lookup range.

In my example formula below, the second zero represents what to return if there is no match.

Excel Formula:
=XLOOKUP("Vader",F1:F3,G1:G3,0,0)
This is sounding positive. To be honest, someone else created the xlookup as I had no idea how to do it :)
 
Upvote 0
There is an argument in the XLOOKUP for "if not found".
Try changing your formula to something like the example below.
Also how did you put the 0 into the IFERROOR. Did you put quotes around it "0" which would make text and not numeric.

Book1
ABCDE
1n0a1
2b2
3c3
4d4
Sheet1
Cell Formulas
RangeFormula
B1B1=XLOOKUP(A1,D1:D4,E1:E4,0)
 
Upvote 0

Forum statistics

Threads
1,214,847
Messages
6,121,911
Members
449,054
Latest member
luca142

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