Counting with multiple OR criteria

Excel_12

New Member
Joined
Dec 3, 2016
Messages
3
Hello,


I've been puzzled by this situation for quite some time now... Below is partial data set and i need a formula where i have to count "In how many events did either the US, Germany or France win a medal?"

This makes it a bit more difficult than usual for sumproduct because of multiple OR criteria in the same ranges.

i tried this formula but i wasnt getting the right answer..

=SUMPRODUCT(--(((($M$6:$M$101)={"United States","Germany","France"})+(($N$6:$N$101)={"United States","Germany","France"})+(($M$6:$M$101)={"United States","Germany","France"}))>0))


Olympic eventGoldSilverBronze
Event 1United KingdomGermanyFrance
Event 2ChinaColombiaChina
Event 3CubaUkrainePoland
Event 4ColombiaColombiaRussia
Event 5PortugalUnited StatesIndonesia
Event 6United StatesChinaPeru

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi,

Use the following formula in E2 and pull down.

=SUMPRODUCT(COUNTIF(B2:D2,{"United States","Germany","France"}))
 
Upvote 0
Try:
Change ranges to match your data.
Excel Workbook
ABCDEF
1Olympic eventGoldSilverBronze**
2Event 1United KingdomGermanyFrance*4
3Event 2ChinaColombiaChina**
4Event 3CubaUkrainePoland**
5Event 4ColombiaColombiaRussia**
6Event 5PortugalUnited StatesIndonesia**
7Event 6United StatesChinaPeru**
Sheet
 
Upvote 0
Try this for your partial dataset:

=SUMPRODUCT(COUNTIF(B2:D7,{"United States","Germany","France"}))
 
Upvote 0
None of the above solve my issue. The closest i got was with my formula... this isn't meant to be easy due to the fact that were looking multiple or criteria in multiple criteria ranges
 
Upvote 0
Based on your example, what result do you expect to see?
 
Upvote 0
Try this...
A​
B​
C​
D​
E​
1​
Olympic eventGoldSilverBronze
2​
Event 1United KingdomGermanyFrance
7​
3​
Event 2ChinaColombiaChina
4​
Event 3CubaUkrainePoland
5​
Event 4ColombiaColombiaRussia
6​
Event 5PortugalUnited StatesIndonesia
7​
Event 6United StatesChinaPeru
8​
Event 7United StatesIndonesiaIndonesia
9​
Event 8IndonesiaGermanyIndonesia
10​
Event 9IndonesiaIndonesiaFrance
11​
12​
United States
2​
1​
0​
13​
Germany
0​
2​
0​
14​
France
0​
0​
2​
E2=SUM(COUNTIF($B$2:$D$10,{"United States","Germany","France"}))

A12:D14 shows a summary by country and type, for comparison
 
Upvote 0
This is how you do it with a helper column i need it to be a one cell solution, thanks... i wish i could attach the file
Criteria Q2
United States
Olympic eventGoldSilverBronzeQ2Germany
1United KingdomGermanyFrance=MIN(1,(COUNTIF(C6:E6,$H$4)+COUNTIF(C6:E6,$H$5)+COUNTIF(C6:E6,$H$6)))France
=B6+1ChinaColombiaChina=MIN(1,(COUNTIF(C7:E7,$H$4)+COUNTIF(C7:E7,$H$5)+COUNTIF(C7:E7,$H$6)))
=B7+1CubaUkrainePoland=MIN(1,(COUNTIF(C8:E8,$H$4)+COUNTIF(C8:E8,$H$5)+COUNTIF(C8:E8,$H$6)))Question 2:In how many events did either the US, Germany or France win a medal?=SUM(F6:F101)
=B8+1ColombiaColombiaRussia=MIN(1,(COUNTIF(C9:E9,$H$4)+COUNTIF(C9:E9,$H$5)+COUNTIF(C9:E9,$H$6)))
=B9+1PortugalUnited StatesIndonesia=MIN(1,(COUNTIF(C10:E10,$H$4)+COUNTIF(C10:E10,$H$5)+COUNTIF(C10:E10,$H$6)))
=B10+1United StatesChinaPeru=MIN(1,(COUNTIF(C11:E11,$H$4)+COUNTIF(C11:E11,$H$5)+COUNTIF(C11:E11,$H$6)))
=B11+1IndonesiaVietnamCroatia=MIN(1,(COUNTIF(C12:E12,$H$4)+COUNTIF(C12:E12,$H$5)+COUNTIF(C12:E12,$H$6)))
=B12+1PhilippinesTunisiaIndonesia=MIN(1,(COUNTIF(C13:E13,$H$4)+COUNTIF(C13:E13,$H$5)+COUNTIF(C13:E13,$H$6)))
=B13+1United StatesChinaComoros=MIN(1,(COUNTIF(C14:E14,$H$4)+COUNTIF(C14:E14,$H$5)+COUNTIF(C14:E14,$H$6)))
=B14+1RussiaUnited StatesPoland=MIN(1,(COUNTIF(C15:E15,$H$4)+COUNTIF(C15:E15,$H$5)+COUNTIF(C15:E15,$H$6)))
=B15+1PolandChinaPhilippines=MIN(1,(COUNTIF(C16:E16,$H$4)+COUNTIF(C16:E16,$H$5)+COUNTIF(C16:E16,$H$6)))
=B16+1United StatesSouth KoreaBrazil=MIN(1,(COUNTIF(C17:E17,$H$4)+COUNTIF(C17:E17,$H$5)+COUNTIF(C17:E17,$H$6)))
=B17+1RussiaColombiaGermany=MIN(1,(COUNTIF(C18:E18,$H$4)+COUNTIF(C18:E18,$H$5)+COUNTIF(C18:E18,$H$6)))
=B18+1IndonesiaChinaVenezuela=MIN(1,(COUNTIF(C19:E19,$H$4)+COUNTIF(C19:E19,$H$5)+COUNTIF(C19:E19,$H$6)))
=B19+1PortugalPhilippinesIndonesia=MIN(1,(COUNTIF(C20:E20,$H$4)+COUNTIF(C20:E20,$H$5)+COUNTIF(C20:E20,$H$6)))
=B20+1IsraelEthiopiaLibya=MIN(1,(COUNTIF(C21:E21,$H$4)+COUNTIF(C21:E21,$H$5)+COUNTIF(C21:E21,$H$6)))
=B21+1IndonesiaKazakhstanPeru=MIN(1,(COUNTIF(C22:E22,$H$4)+COUNTIF(C22:E22,$H$5)+COUNTIF(C22:E22,$H$6)))
=B22+1ChinaGeorgiaEl Salvador=MIN(1,(COUNTIF(C23:E23,$H$4)+COUNTIF(C23:E23,$H$5)+COUNTIF(C23:E23,$H$6)))
=B23+1BrazilBulgariaUnited Kingdom=MIN(1,(COUNTIF(C24:E24,$H$4)+COUNTIF(C24:E24,$H$5)+COUNTIF(C24:E24,$H$6)))
=B24+1IndonesiaMoroccoChina=MIN(1,(COUNTIF(C25:E25,$H$4)+COUNTIF(C25:E25,$H$5)+COUNTIF(C25:E25,$H$6)))
=B25+1ChinaUkraineChina=MIN(1,(COUNTIF(C26:E26,$H$4)+COUNTIF(C26:E26,$H$5)+COUNTIF(C26:E26,$H$6)))
=B26+1ChinaChinaChina=MIN(1,(COUNTIF(C27:E27,$H$4)+COUNTIF(C27:E27,$H$5)+COUNTIF(C27:E27,$H$6)))
=B27+1United StatesChinaChina=MIN(1,(COUNTIF(C28:E28,$H$4)+COUNTIF(C28:E28,$H$5)+COUNTIF(C28:E28,$H$6)))
=B28+1IndonesiaChinaChina=MIN(1,(COUNTIF(C29:E29,$H$4)+COUNTIF(C29:E29,$H$5)+COUNTIF(C29:E29,$H$6)))
=B29+1ArmeniaFranceColombia=MIN(1,(COUNTIF(C30:E30,$H$4)+COUNTIF(C30:E30,$H$5)+COUNTIF(C30:E30,$H$6)))

<colgroup><col><col><col><col><col><col><col><col><col span="2"></colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,216,113
Messages
6,128,905
Members
449,478
Latest member
Davenil

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