In Excel, how do I check if a cell is in a list of values (a range of cells)
=COUNTIF(some_names,D1)
should work (1 if the name is present - more if more than one instance).
My preferred answer (modified from Ian's) is:
=COUNTIF(some_names,D1)>0
which returns TRUE if D1 is found in the range some_names at least once, or FALSE otherwise.
(COUNTIF returns an integer of how many times the criterion is found in the range)
I know the OP specifically stated that the list came from a range of cells, but others might stumble upon this while looking for a specific range of values.
You can also look up on specific values, rather than a range using the MATCH
function. This will give you the number where this matches (in this case, the second spot, so 2). It will return #N/A if there is no match.
=MATCH(4,{2,4,6,8},0)
You could also replace the first four with a cell. Put a 4 in cell A1 and type this into any other cell.
=MATCH(A1,{2,4,6,8},0)