Count Unique for children who have not taken a test

Stephen_IV

Well-known Member
Joined
Mar 17, 2003
Messages
1,177
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Good morning,
I have some data that has a number of tests on it that kids are allowed to take. The first problem is that kids can take any number of tests. The second problem is that the for each test that the kid is enrolled in, it will show a 1 for test taken and a 0 for test not taken. As long as a kid has a 1 then that means that a kid has taken a test. I need to count how many kids did not take a test. based on the school. This is the formula that I used if I know how many tests a child has taken =SUM(IF(FREQUENCY(IF(($B$2:$B$27=0)*($C$2:$C$27=$I2),$A$2:$A$27),$A$2:$A$26)=10,1)) but it obviously does not work because each child will take a different amount of tests.
<style type="text/css">
table.tableizer-table {
font-size: 12px;
border: 1px solid #CCC ;
font-family: Arial, Helvetica, sans-serif;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #CCC ;
}
.tableizer-table th {
background-color: #104E8B ;
color: #FFF ;
font-weight: bold;
}
</style>
<table class="tableizer-table">
<thead><tr class="tableizer-firstrow"><th>ID</th><th>Test Taken</th><th>School</th></tr></thead><tbody>
<tr><td>9999</td><td>0</td><td>xxxx</td></tr>
<tr><td>9999</td><td>0</td><td>xxxx</td></tr>
<tr><td>9999</td><td>0</td><td>xxxx</td></tr>
<tr><td>9999</td><td>0</td><td>xxxx</td></tr>
<tr><td>9999</td><td>1</td><td>xxxx</td></tr>
<tr><td>9999</td><td>0</td><td>xxxx</td></tr>
<tr><td>9999</td><td>0</td><td>xxxx</td></tr>
<tr><td>9999</td><td>0</td><td>xxxx</td></tr>
<tr><td>9999</td><td>0</td><td>xxxx</td></tr>
<tr><td>9999</td><td>0</td><td>xxxx</td></tr>
<tr><td>1111</td><td>0</td><td>yyyy</td></tr>
<tr><td>1111</td><td>0</td><td>yyyy</td></tr>
<tr><td>1111</td><td>0</td><td>yyyy</td></tr>
<tr><td>1111</td><td>0</td><td>yyyy</td></tr>
<tr><td>1111</td><td>0</td><td>yyyy</td></tr>
<tr><td>1111</td><td>0</td><td>yyyy</td></tr>
<tr><td>2222</td><td>0</td><td>yyyy</td></tr>
<tr><td>2222</td><td>1</td><td>yyyy</td></tr>
<tr><td>2222</td><td>0</td><td>yyyy</td></tr>
<tr><td>2222</td><td>0</td><td>yyyy</td></tr>
<tr><td>2222</td><td>1</td><td>yyyy</td></tr>
<tr><td>2222</td><td>1</td><td>yyyy</td></tr>
<tr><td>2222</td><td>0</td><td>yyyy</td></tr>
</tbody></table>

This is what I am looking for
<style type="text/css">
table.tableizer-table {
font-size: 12px;
border: 1px solid #CCC ;
font-family: Arial, Helvetica, sans-serif;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #CCC ;
}
.tableizer-table th {
background-color: #104E8B ;
color: #FFF ;
font-weight: bold;
}
</style>
<table class="tableizer-table">
<thead><tr class="tableizer-firstrow"><th>ID</th><th>Test Taken</th></tr></thead><tbody>
<tr><td>xxxx</td><td>0</td></tr>
<tr><td>yyyy</td><td>1</td></tr>
<tr><td>zzzz</td><td>0</td></tr>
</tbody></table>
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Maybe:

ABCDEF
xxxxxxxx
xxxxyyyy
xxxx
xxxx
xxxx
xxxx
xxxx
xxxx
xxxx
xxxx
yyyy
yyyy
yyyy
yyyy
yyyy
yyyy
yyyy
yyyy
yyyy
yyyy
yyyy
yyyy
yyyy

<tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]ID[/TD]
[TD="align: center"]Test Taken[/TD]
[TD="align: center"]School[/TD]
[TD="align: right"][/TD]
[TD="align: center"]School[/TD]
[TD="align: center"]# students who have taken no tests[/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]9999[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"][/TD]

[TD="align: right"]0[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]9999[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"][/TD]

[TD="align: right"]1[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]9999[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"][/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]9999[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"][/TD]

[TD="align: center"]6[/TD]
[TD="align: right"]9999[/TD]
[TD="align: right"]1[/TD]

[TD="align: right"][/TD]

[TD="align: right"][/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]9999[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]8[/TD]
[TD="align: right"]9999[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]9[/TD]
[TD="align: right"]9999[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]10[/TD]
[TD="align: right"]9999[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]11[/TD]
[TD="align: right"]9999[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]12[/TD]
[TD="align: right"]1111[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]13[/TD]
[TD="align: right"]1111[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]14[/TD]
[TD="align: right"]1111[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]15[/TD]
[TD="align: right"]1111[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]16[/TD]
[TD="align: right"]1111[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]17[/TD]
[TD="align: right"]1111[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]18[/TD]
[TD="align: right"]2222[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]19[/TD]
[TD="align: right"]2222[/TD]
[TD="align: right"]1[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]20[/TD]
[TD="align: right"]2222[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]21[/TD]
[TD="align: right"]2222[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]22[/TD]
[TD="align: right"]2222[/TD]
[TD="align: right"]1[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]23[/TD]
[TD="align: right"]2222[/TD]
[TD="align: right"]1[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]24[/TD]
[TD="align: right"]2222[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]25[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet8

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Array Formulas[TABLE="width: 100%"]
<tbody>[TR]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH]E2[/TH]
[TD="align: left"]{=IFERROR(INDEX($C$2:$C$30,MATCH(0,COUNTIF($C$2:$C$30,"<"&$C$2:$C$30)-SUM(COUNTIF($C$2:$C$30,F$1:F1)),0)),"")}[/TD]
[/TR]
[TR]
[TH]F2[/TH]
[TD="align: left"]{=IF(E2="","",SUM(SIGN(FREQUENCY(IF($C$2:$C$30=E2,IF(COUNTIFS($A$2:$A$30,$A$2:$A$30,$B$2:$B$30,1,$C$2:$C$30,E2)=0,$A$2:$A$30)),$A$2:$A$30))))}[/TD]
[/TR]
</tbody>[/TABLE]
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself[/TD]
[/TR]
</tbody>[/TABLE]



If you already have a list of schools, you can use that. Otherwise, the E2 formula creates a sorted unique list of the schools. The F2 formula counts how many students at each school have take no tests. This assumes the student ID is numeric, but it's easy enough to change if that's not true.
 
Last edited:
Upvote 0
Eric W! Amazing, I have been on this for days trying to figure it out. Thanks to you I am good!!! Appreciate all of your help and guidance. Thank you again!!!!!!!!!
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,318
Members
452,634
Latest member
cpostell

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