Forum Discussion
lbbrown
Jan 24, 2020Copper Contributor
Problem using IF(ISERROR(VLookup(... to see if text matches
I have a file with a column (column Z) of room numbers, and I am trying to use a Vlookup in column AA to see if the room number is listed in column A of a tab in the same file named "RoomList". If th...
Riny_van_Eekelen
Jan 25, 2020Platinum Contributor
Almost right. Try it this way:
=IF(ISERROR(VLOOKUP(Z2,RoomList!A:A,1,FALSE)),"Delete","Keep")
Using TRUE in Vlookup almost always returns a match. E.g. if you have two room numbers in the list, say 100 and 110 and you lookup 105, TRUE returns 100. Lookup 120 and you'll get 110. It picks the nearest number not greater than your lookup value. If you would lookup 90, however, you'll get #NA! So, if you are not searching for room numbers that are lower than the ones in your list, your formula never returns an ERROR and thus always picks the second option "DELETE" from your IF-statement.
Using FALSE, on the other hand, always forces Vlookup to search for an exact match.
lbbrown
Jan 31, 2020Copper Contributor