Home » excel » excel – ISERROR + VLOOKUP different results for empty cells

excel – ISERROR + VLOOKUP different results for empty cells

Posted by: admin May 14, 2020 Leave a comment

Questions:

I was trying to make simple check of vlookup:

=IF(ISERROR(VLOOKUP(B2;SA!C:K;2;FALSE));"Error";VLOOKUP(B2;SA!C:K;2;FALSE))

Issue is that i got two different results for two empty cells.

Error

and

0

All cells are with the same type: General. Do not see why this is different :/

I was expecting message in case of iserror = TRUE (cell is empty). This case “Error”.

Sample file: https://www.dropbox.com/s/jzoq9530qxtig38/ZZZ.xlsm?dl=0.

How to&Answers:

In C2 use the following formula:

=IFERROR(IF(LEN(INDEX(SA!$D:$K,MATCH($B2,SA!$C:$C,0),COLUMN(A1)))=0,"error",INDEX(SA!$D:$K,MATCH($B2,SA!$C:$C,0),COLUMN(A1))),"error")

Edit, since you don’t really want to show “error” but “” instead, you could also try:

=IFERROR(INDEX(SA!$D:$K,MATCH($B2,SA!$C:$C,0),COLUMN(A1))&""),"error")

Answer:

You are getting 0 because VLOOKUP found key, however the value next to it was empty.

To mark those as Error as well use:

=IF(LEN(IFERROR(VLOOKUP(B2;SA!C:K;2;FALSE);"Error"))=0;"Error";IFERROR(VLOOKUP(B2;SA!C:K;2;FALSE);"Error"))