Searching for text within cells

  • Thread starter Thread starter Alan
  • Start date Start date
A

Alan

I want to create an IF statement that does something like this:

(Formula in cell B1) - IF A1 contains "red" then return "red", else if A1
contains "blue", return "blue", else if A1 contains "black" return "black"
else .... and so on. I realise I have a 7 nested if limit.

Can anyone help?

TIA, Alan
 
Hello Alan
There may be simpler but anyway here's a try:
=INDEX({"blue";"red";"black"},MATCH(A1,{"blue";"red";"black"},0))
And you may add some test with somthing like :
=IF(NOT(ISERROR(....

HTH
Cordially
Pascal
 
Alan,

=INDEX({"Blue";"Red";"Black"},SUMPRODUCT((
COUNTIF(A1,"*"&{"Blue";"Red";"Black"}&"*")>0)
*ROW($1:$3)))


--
Regards,
Soo Cheon Jheong
Seoul, Korea
_ _
^¢¯^
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top