COUNTIF + INDEX MATCH with partial match

Margooox

New Member
Joined
Jul 19, 2021
Messages
27
Office Version
  1. 365
Platform
  1. Windows
Hello everyone!

1628707294374.png


I have this intersectionnal grid which shows me all the harmonious flavor combinations you can make while cooking.
"G" stands for "Good" and "AT" stands for "Acquired Taste".


1628707248742.png


I have written this formula to be able to check the value from the intersection of the row of Ingredient1 with the column of Ingredient 2.
I need the match to be partial as I will have different types of ingredients. Example: green apple, red apple, candied apple, applesauce.... which all contain the word "apple" and share the same flavor as a result.

This formula currently returns #N/A errors. Any idea why?

Thank you so much in advance!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
It looks like it should work. unless whatever in cells F5 or F7 doesn't match at all (some spelling mistake).

Here is something that will output a filtered array:
Mr Excel Playground 3.xlsm
ABCDEFGH
1AppleBeanCurryDry AppleEggEggplantFried Egg
2AppleGG
3BeanGGGG
4CurryGGG
5Dry AppleGGATG
6EggG
7EggplantGG
8Fried EggGG
9
10
11Item 1Apple
12Item 2Egg
13
14 EggEggplantFried Egg
15       
16AppleG     
17Dry AppleATG    
18      
19      
20      
21      
22      
Sheet12
Cell Formulas
RangeFormula
B14:E14B14=SORT(UNIQUE(IF(IFERROR(SEARCH(C12,B1:H1),"")<>"",B1:H1,""),TRUE))
B15:B17B15=SORT(UNIQUE(IF(IFERROR(SEARCH(C11,A2:A8),"")<>"",A2:A8,"")))
C15:H22C15=IF(IFNA(INDEX($B$2:$H$8,MATCH($B15,$A$2:$A$8,0),MATCH(C$14,$B$1:$H$1,0)),"")=0,"",IFNA(INDEX($B$2:$H$8,MATCH($B15,$A$2:$A$8,0),MATCH(C$14,$B$1:$H$1,0)),""))
Dynamic array formulas.
 
Upvote 0
Looks like the wildards should be on the aroma combinations, not the recipe plans.
 
Upvote 0
It looks like it should work. unless whatever in cells F5 or F7 doesn't match at all (some spelling mistake).

Here is something that will output a filtered array:
Mr Excel Playground 3.xlsm
ABCDEFGH
1AppleBeanCurryDry AppleEggEggplantFried Egg
2AppleGG
3BeanGGGG
4CurryGGG
5Dry AppleGGATG
6EggG
7EggplantGG
8Fried EggGG
9
10
11Item 1Apple
12Item 2Egg
13
14 EggEggplantFried Egg
15       
16AppleG     
17Dry AppleATG    
18      
19      
20      
21      
22      
Sheet12
Cell Formulas
RangeFormula
B14:E14B14=SORT(UNIQUE(IF(IFERROR(SEARCH(C12,B1:H1),"")<>"",B1:H1,""),TRUE))
B15:B17B15=SORT(UNIQUE(IF(IFERROR(SEARCH(C11,A2:A8),"")<>"",A2:A8,"")))
C15:H22C15=IF(IFNA(INDEX($B$2:$H$8,MATCH($B15,$A$2:$A$8,0),MATCH(C$14,$B$1:$H$1,0)),"")=0,"",IFNA(INDEX($B$2:$H$8,MATCH($B15,$A$2:$A$8,0),MATCH(C$14,$B$1:$H$1,0)),""))
Dynamic array formulas.
Thanks for the help!

What I'm trying to achieve is a way to calculate how many "G" are found within my recipe as a whole by comparing all the ingredients used as shown in the example below:
1628715048970.png
 
Upvote 0
So I would need a number to be returned for each "G" found, hence my use of the COUNTIF formula.
I'm new at Excel so I'm not even sure if this is the best method to achieve something like that.
 
Upvote 0
One observation, F5 is empty so the wildcard match will always return the first item in the criteria range, in the example provided that is B2, so it will be counting in row 2 where there are no "G"'s to count.
 
Upvote 0
One observation, F5 is empty so the wildcard match will always return the first item in the criteria range, in the example provided that is B2, so it will be counting in row 2 where there are no "G"'s to count.
That was actually what was causing the problem!

Now I gotta figure out a way of comparing each cell to the group so that I don't need to copy paste the same line 50 times!
 
Upvote 0
Now I gotta figure out a way of comparing each cell to the group so that I don't need to copy paste the same line 50 times!
Not following exactly what you mean by 'the group' when looking at your images but I'm sure it should be something fairly simple.
 
Upvote 0
Not following exactly what you mean by 'the group' when looking at your images but I'm sure it should be something fairly simple.
I need to compare F5 with F7, F8, F9, etc... Essentially run COUNTIF for my entire ingredients list.
 
Upvote 0

Forum statistics

Threads
1,215,340
Messages
6,124,386
Members
449,155
Latest member
ravioli44

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top