I would like to use a formula to identify if a cell in a group of cell contains a specific word. Example, I'd like to search if a cell has the content X The formula's response could be 1 if found, 0 if not found.
1 Answer
Using the IF
function you can do this. Here is the syntax;
IF(logical_test, [value_if_true], [value_if_false])
In a cell you can enter the formula to check a cell for the existence of X
. If it is there the formula result will be a 1
, else-wise a 0
.
=IF(A1="X", 1,0)
Here it is in a sheet;
Side Note: Sorry for the basic answer, but your question is too vague to give you a more specific details. You might want to read how to ask to improve your question quality.
-
I agree that the question is vague, but it mentions “a group of cell” [sic], which suggests to me that the OP is interested in having a cell that checks a range of cells –– something like
=OR($A1:$A12="X")
, entered as an array formula. Another ambiguity in the question is the phrase “contains a specific word”. What if a cell contains “The quick brown fox” and X is “fox”? Then a simple=
isn’t good enough; you need to do aFIND
. Jun 24, 2013 at 19:50 -
@scott They also stated "I'd like to search if a cell has the content X" which the above answer is a simple solution for. IMO, without more details it would be unreasonable to read into the question. Feel free to post an answer with a formula using
FIND
. There are more ways than one to get the same results. Jun 24, 2013 at 20:17 -
Thanks for the answers, I am sorry if I was not clear enough. I am trying to find if one cell in group of cells has a specific content such as the letter X only (not part of a word like fox). I hope this is clearer. JP Jun 25, 2013 at 4:49