Countif Table

Alphacsulb

Active Member
Joined
Mar 20, 2008
Messages
414
Hello, I have a reception Im going to be keeping track of those people who arrive and I need 2 formulas to keep track of how many group of people have arrived, and of those how many of them are getting an award.

I'm not sure how to attach my spreadsheet anymore since I've gone to Excel 2016 so hopefully this show up correctly. Below is the desired result. Thank you for the leads. :eeek:

DATA

[TABLE="width: 316"]
<tbody>[TR]
[TD]Arrived[/TD]
[TD]Name[/TD]
[TD]Group[/TD]
[TD]Award[/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]Lisa[/TD]
[TD]Soccer[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]Bob[/TD]
[TD]Baseball[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Robert[/TD]
[TD]Baseball[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Mike[/TD]
[TD]Golf[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]Ben[/TD]
[TD]Soccer[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]Scott[/TD]
[TD]Soccer[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]Dave[/TD]
[TD]Golf[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Dan[/TD]
[TD]Soccer[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]Pat[/TD]
[TD]Baseball[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]Kyle[/TD]
[TD]Golf[/TD]
[TD]Yes[/TD]
[/TR]
</tbody>[/TABLE]


DESIRED RESULT:

[TABLE="width: 338"]
<tbody>[TR]
[TD]Summary:[/TD]
[TD] Arrived[/TD]
[TD] Arrived and Award[/TD]
[/TR]
[TR]
[TD]Baseball[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Golf[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Soccer[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]2[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Try this
<table valign="top" border="1"><caption>LEGO HTML</caption><col width="54"><col width="124"><col width="124"><col width="124">
<tr><td></td><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">A</font></th><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">B</font></th><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">C</font></th></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">1</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Arrived</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Name</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Group</font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">2</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">X</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Lisa</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Soccer</font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">3</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">X</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Bob</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Baseball</font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">4</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Robert</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Baseball</font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">5</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Mike</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Golf</font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">6</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">X</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Ben</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Soccer</font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">7</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">X</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Scott</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Soccer</font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">8</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">X</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Dave</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Golf</font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">9</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Dan</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Soccer</font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">10</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">X</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Pat</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Baseball</font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">11</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">X</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Kyle</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Golf</font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">12</font></th><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)"></font></td><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)"></font></td><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)"></font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">13</font></th><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)"></font></td><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)"></font></td><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)"></font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">14</font></th><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)"></font></td><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)"></font></td><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)"></font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">15</font></th><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)">Summary</font></td><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)">Arrived</font></td><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)">Arrived And Award</font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">16</font></th><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)">Baseball</font></td><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)">2</font></td><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)">1</font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">17</font></th><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)">Golf</font></td><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)">2</font></td><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)">2</font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">18</font></th><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)">Soccer</font></td><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)">3</font></td><td style="background-color:rgb(255, 255, 255)"><font face="Calibri" style="color:rgb(0, 0, 0)">2</font></td></tr></table><table style="width:100%" valign="top" border="1"><caption>Worksheet Formulas</caption><tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">Cell</font></th><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">Formula</font></th></tr><tr><th style="background-color:rgb(255, 255, 255)"><font style="color:rgb(0, 0, 0)">B16</font></th></td><td style="background-color:rgb(255, 255, 255)"><font style="color:rgb(0, 0, 0)">=COUNTIFS($A$2:$A$11,"X",$C$2:$C$11,A16)</font></td></tr><tr><th style="background-color:rgb(255, 255, 255)"><font style="color:rgb(0, 0, 0)">C16</font></th></td><td style="background-color:rgb(255, 255, 255)"><font style="color:rgb(0, 0, 0)">=COUNTIFS($A$2:$A$11,"X",$D$2:$D$11,"Yes",$C$2:$C$11,A16)</font></td></tr><tr><th style="background-color:rgb(255, 255, 255)"><font style="color:rgb(0, 0, 0)">B17</font></th></td><td style="background-color:rgb(255, 255, 255)"><font style="color:rgb(0, 0, 0)">=COUNTIFS($A$2:$A$11,"X",$C$2:$C$11,A17)</font></td></tr><tr><th style="background-color:rgb(255, 255, 255)"><font style="color:rgb(0, 0, 0)">C17</font></th></td><td style="background-color:rgb(255, 255, 255)"><font style="color:rgb(0, 0, 0)">=COUNTIFS($A$2:$A$11,"X",$D$2:$D$11,"Yes",$C$2:$C$11,A17)</font></td></tr><tr><th style="background-color:rgb(255, 255, 255)"><font style="color:rgb(0, 0, 0)">B18</font></th></td><td style="background-color:rgb(255, 255, 255)"><font style="color:rgb(0, 0, 0)">=COUNTIFS($A$2:$A$11,"X",$C$2:$C$11,A18)</font></td></tr><tr><th style="background-color:rgb(255, 255, 255)"><font style="color:rgb(0, 0, 0)">C18</font></th></td><td style="background-color:rgb(255, 255, 255)"><font style="color:rgb(0, 0, 0)">=COUNTIFS($A$2:$A$11,"X",$D$2:$D$11,"Yes",$C$2:$C$11,A18)</font></td></tr></table>
 
Upvote 0
Try


[Table="class: grid"][tr][td="bgcolor: #DCE6F1"][/td][td="bgcolor: #DCE6F1"]
A
[/td][td="bgcolor: #DCE6F1"]
B
[/td][td="bgcolor: #DCE6F1"]
C
[/td][td="bgcolor: #DCE6F1"]
D
[/td][td="bgcolor: #DCE6F1"]
E
[/td][td="bgcolor: #DCE6F1"]
F
[/td][td="bgcolor: #DCE6F1"]
G
[/td][td="bgcolor: #DCE6F1"]
H
[/td][/tr]
[tr][td="bgcolor: #DCE6F1"]
1
[/td][td]
Arrived​
[/td][td]
Name​
[/td][td]
Group​
[/td][td]
Award​
[/td][td][/td][td]
Summary:​
[/td][td]
Arrived​
[/td][td]
Arrived and Award​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
2
[/td][td]
X​
[/td][td]
Lisa​
[/td][td]
Soccer​
[/td][td][/td][td][/td][td]
Baseball​
[/td][td]
2​
[/td][td]
1​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
3
[/td][td]
X​
[/td][td]
Bob​
[/td][td]
Baseball​
[/td][td]
Yes​
[/td][td][/td][td]
Golf​
[/td][td]
2​
[/td][td]
2​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
4
[/td][td][/td][td]
Robert​
[/td][td]
Baseball​
[/td][td][/td][td][/td][td]
Soccer​
[/td][td]
3​
[/td][td]
2​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
5
[/td][td][/td][td]
Mike​
[/td][td]
Golf​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
6
[/td][td]
X​
[/td][td]
Ben​
[/td][td]
Soccer​
[/td][td]
Yes​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
7
[/td][td]
X​
[/td][td]
Scott​
[/td][td]
Soccer​
[/td][td]
Yes​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
8
[/td][td]
X​
[/td][td]
Dave​
[/td][td]
Golf​
[/td][td]
Yes​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
9
[/td][td][/td][td]
Dan​
[/td][td]
Soccer​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
10
[/td][td]
X​
[/td][td]
Pat​
[/td][td]
Baseball​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
11
[/td][td]
X​
[/td][td]
Kyle​
[/td][td]
Golf​
[/td][td]
Yes​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
12
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]


Formula in G2 copied down
=COUNTIFS(C$2:C$11,F2,A$2:A$11,"x")

Formula in H2 copied down
=COUNTIFS($C$2:$C$11,$F2,$A$2:$A$11,"x",D$2:D$11,"Yes")

M.
 
Upvote 0
[table="width: 0, class: grid, align: left"][tr][td]
[table="width: 0, class: grid, align: left"]
[tr][th][/th][th]A[/th][th]B[/th][th]C[/th][th]D[/th][th]E[/th][th]F[/th][th]G[/th][th]H[/th][/tr]
[tr][th]1[/th][td]Arrived[/td][td]Name[/td][td]Group[/td][td]Award[/td][td][/td][td]Summary:[/td][td]Arrived[/td][td]Arrived and Award[/td][/tr]
[tr][th]2[/th][td]X[/td][td]Lisa[/td][td]Soccer[/td][td][/td][td][/td][td]Baseball[/td][td]
2​
[/td][td]
1​
[/td][/tr]
[tr][th]3[/th][td]X[/td][td]Bob[/td][td]Baseball[/td][td]Yes[/td][td][/td][td]Golf[/td][td]
2​
[/td][td]
2​
[/td][/tr]
[tr][th]4[/th][td][/td][td]Robert[/td][td]Baseball[/td][td][/td][td][/td][td]Soccer[/td][td]
3​
[/td][td]
2​
[/td][/tr]
[tr][th]5[/th][td][/td][td]Mike[/td][td]Golf[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][th]6[/th][td]X[/td][td]Ben[/td][td]Soccer[/td][td]Yes[/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][th]7[/th][td]X[/td][td]Scott[/td][td]Soccer[/td][td]Yes[/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][th]8[/th][td]X[/td][td]Dave[/td][td]Golf[/td][td]Yes[/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][th]9[/th][td][/td][td]Dan[/td][td]Soccer[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][th]10[/th][td]X[/td][td]Pat[/td][td]Baseball[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][th]11[/th][td]X[/td][td]Kyle[/td][td]Golf[/td][td]Yes[/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]
[/td][/tr][/table]


Cell G2
=COUNTIFS(A:A,"X",C:C,F2)

Cell H2
=COUNTIFS(A:A,"X",C:C,F2,D:D,"Yes")
 
Last edited:
Upvote 0
And here's a Power Query version.

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Arrived", type text}, {"Name", type text}, {"Group", type text}, {"Award", type any}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"Name"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Removed Columns",{"Group", "Arrived", "Award"}),
    #"Added Custom" = Table.AddColumn(#"Reordered Columns", "Custom", each [Arrived]="X"),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each [Arrived]="X" and [Award]="Yes"),
    #"Removed Columns1" = Table.RemoveColumns(#"Added Custom1",{"Arrived", "Award"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns1",{{"Custom", "Arrived"}, {"Custom.1", "Arrived and Award"}}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Renamed Columns",{{"Arrived", Int64.Type}, {"Arrived and Award", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type1", {"Group"}, {{"Arrived", each List.Sum([Arrived]), type number}, {"Arrived and Award", each List.Sum([Arrived and Award]), type number}}),
    #"Sorted Rows" = Table.Sort(#"Grouped Rows",{{"Group", Order.Ascending}})
in
    #"Sorted Rows"
 
Upvote 0

Forum statistics

Threads
1,223,969
Messages
6,175,682
Members
452,667
Latest member
vanessavalentino83

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