I am using =IF(VLOOKUP(A2;$B$2:$B$11;B2;FALSE); TRUE; FALSE)
to lookup a value in the column A.
As you can see my formula does not seem valid. Any suggestions why this is the case?
I appreciate your answer!
UPDATE
I am currently getting with =ISNUMBER(VLOOKUP(A2;$B$2:$B$11;1;FALSE))
only FALSE
values. However I want to see True
if there is a match:
Update
Using =Not(ISNA(VLOOKUP(A2;$B$2:$B$11;1;FALSE)))
and =ISNUMBER(MATCH(A2, $B$2:$B$11, 0))
gives me the same result:
VLOOKUP
takes the following arguments:
=VLOOKUP(lookup_value; table_array; col_index_num; [range_lookup])
lookup_value
is what will be looked for in the first column of table_array
.
table_array
is the table in which the lookup_value
and the value to be returned are.
col_index_num
is the number indicating the nth column within table_array
from which the value is to be returned from.
[range_lookup]
(defaults to true
) indicates the type of lookup, true being approximate and false being exact.
As such, if you want to find if A2
is in table $B$2:$B$11
, you need to use a col_index_num
of 1.
A simpler formula however would be with MATCH
:
=ISNUMBER(MATCH(A2; $B$2:$B$11; 0))
MATCH
returns the relative row number in which the value A2
is found. If there is a match, you get a number and hence ISNUMBER
returns TRUE
.
If you want to check if a value from column B exists in column A, then you have it reversed in the formula you used. Turning it around gives:
=ISNUMBER(MATCH(B2; $A$2:$A$11; 0))
Answer:
You could also use COUNTIF
, i.e. this formula in C2 copied down
=COUNTIF(A$2:A$11,B2)>0
Tags: excelexcel