Avoiding double evaluation pre XL2007 can be tricky...
If the data type of XYZ is consistent - ie always number or always text for ex. then you can avoid using LOOKUP, eg
Numbers
=LOOKUP(9.99999999999999E+307;CHOOSE({1;2};0;XYZ))
Text
=LOOKUP(REPT("Z";255);CHOOSE({1;2};"";XYZ))
(above open to error if XYZ exceeds char limits)
If the above aren't viable then you're looking at using VBA to create a UDF to mimic the XL2007 IFERROR function, eg
Public Function IFERR(vOne As Variant, vDefault As Variant) As Variant
IFERR = IIF(IsError(vOne),vDefault,vOne)
End Function
The above, stored in a Module in VBEditor, is used from native XL along the lines of:
(you will find plenty of more advanced examples of the above UDF approach if you google etc...)
In XL2007 MS finally added the long overdue IFERROR worksheet function
=IFERROR(XYZ;"")
Of course the other more basic approach is to calc XYZ in one cell and use another to output final result, eg
A1: =XYZ
B1: =IF(ISERROR(A1),"",A1)
Bookmarks