Avoid xmatch returning #N/A

XMATCH(“0”,A3:A10000,0,-1)

I am using xmatch to find the last position of the string “0” in a column of random numbers. If the number is found then it is ok. If not found, then it is returning the string “#N/A”. Is it possible to do a check that if the value returned by xmatch is “#N/A” then return the empty string instead?

I am thinking something like this but for some reason it does not work

=IF(XMATCH(“0”,A3:A10000,0,-1)="#N/A", “”, XMATCH(“0”,A3:A10000,0,-1))

Sorry for the question. I should wrap XMATCH with ISNA eg

=IF(ISNA(XMATCH(“0”,A3:A10000,0,-1)), “”, XMATCH(“0”,A3:A10000,0,-1))

1 Like

No - literal numbers dont need quotes around
No - you should use semicolon instead comma in formulas ( to make them work in any Locale
No - you should use IFNA… instead IF(ISNA…

=IFNA(XMATCH(0;A3:A10000;0;-1);"")
2 Likes

These are good tips for a newbie to calc macros like me. Thanks a lot!