0

Let's say I have 6 cells containing these words respectively:

  1. RICE CAKE (T)
  2. COOKING OIL (T)
  3. SUGAR ROLL (T)
  4. CENTURY EGGS (T)
  5. SALTED EGGS (T)
  6. LARGE EGGS (E)

I used this formula but it did not work fully. =IF(COUNT(SEARCH({"*oil*","salted*","*sugar*","*rice*","*century*"},A1)),"T",FALSE)

  • What should I add in the formula to make sure that cell 6 would return value of "E"?
  • RICE, OIL, SUGAR, CENTURY, SALTED should return a value of "T" (as shown in my formula)
  • EGGS alone should return a value of "E" (like in cell number 6 WITHOUT coinciding with cell number 4 and 5 which contains eggs as well but they should be T)

How do I use any formula to return the correct value.

1 Answer 1

1

You can try this version

=IF(SUM(COUNTIF(H222,"*"&{"Rice","Oil","sugar","Century","Salted"}&"*")),"T",IF(ISNUMBER(SEARCH("eggs",H222)),"E",""))

Add "Quail" to the first part if required

Edit: I didn't see your edit - I think that's a version I suggested elsewhere (with COUNT). That should work, what problem did you get? You don't need the "wildcards" with SEARCH (you do with COUNTIF) so that could be like this

=IF(COUNT(SEARCH({"oil","salted","sugar","rice","century"},A1)),"T",IF(ISNUMBER(SEARCH("eggs",A1)),"E",""))

Sign up to request clarification or add additional context in comments.

3 Comments

wow thank you very much! how do you know the cell I am gonna use is H222? :O
oh i was wondering how come! anyways thank you very much barry :) glad for your help! much appreciated!
+ 1 Another nice formula Barry :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.