0

I want to search for a given sub-string in column D when conditions are met in columns A and B.

A simple countifs as suggested in the question Count if two criteria match - EXCEL formula does not match because I would like the ingredient (Chocolate in my example) to be part of the values and not an exact match like in that question. It is therefore NOT a duplicate question.

Let's say I own a restaurant (I wish :) and I have this:

  1. Column A: the category of a dish
  2. Column B: the price range of the dish
  3. Column C: the name of a dish
  4. Column D: a list of ingredients in that dish

List of ingredients in each dish

I want to search if any of the main course that is expensive contains chocolate (i.e. putting in a cell the value FALSE, "No" or 0). It could look like something like that

Expected

I don't want to do this by using VBA but rather using Excel Formulas.

Really appreciate your help.

Thanks

[NOTE]: The difference with the suggested related question is to add * in the matched strings. Although a small difference, it is what made me ask the question in the first place.

Jean-Francois T.
  • 11,549
  • 7
  • 68
  • 107
  • @brettdj Similar question but not duplicate. The difference lied in the `"*"` it the criteria. – Jean-Francois T. Apr 06 '17 at 02:39
  • My view (which is subjective) is that is a minor difference, furthemore the other question provided answers that work for all excel versions, hence better others get directed to that. Good that you got an answer here though. – brettdj Apr 06 '17 at 04:04

2 Answers2

6

CountIfS is your friend here

=COUNTIFS(A:A,"Main",B:B,"Expensive",D:D,"*chocolate*")>0
chris neilsen
  • 52,446
  • 10
  • 84
  • 123
0

Enter into E2:

=AND(A2="Main",B2="Expensive",IFERROR(SEARCH("Chocolate",D2)>=0,FALSE))

And drag down.

Alejandro C De Baca
  • 888
  • 2
  • 9
  • 16