Home » excel » excel – Check if a cell contains values from a list

excel – Check if a cell contains values from a list

Posted by: admin March 9, 2020 Leave a comment

Questions:

I am trying to check if a cell contains (not equals) a value from a list. I would prefer if the formula returned a true/false result so I can further embed it into an if function.

Sample of values in cells I want to check. For clarity, please call these column A in suggestions.

MIA/EWR/MIA
LGA/PIT
HKG/TPE/HKG/MNL/HKG
LGB/IAD
MIA/GRU/MIA
YUL/LGA
FLL/BOG/MDE/FLL SFO/LAX/SFO

A sample of what I would like to check for is below. I have 165 values I need to check if that makes a difference in your suggestion. Please reference column B for this list.
BOG
BOM
GRU
JAL
MDE
MNL
THR
TUN

Thank you in advance!

How to&Answers:

Based on your description, the data setup looks like this:

enter image description here

In cell C2 and copied down is this formula:

=SUMPRODUCT(COUNTIF(A2,"*"&$B$2:$B$11&"*"))>0

Answer:

Just Insert the following formula in cell C2: =NB.SI(A:A;B2)
the result:

  • 0 : if the value not exist in the list
  • [number > 0] : if the value exist

Note: the formula is extracted in French Excel. use that same English