Count names based on enrollment

paulkc

Board Regular
Joined
May 18, 2007
Messages
220
Office Version
  1. 365
I'm trying to process a lot of student data to gather retention data from year to year. Columns A and B contain the students first and last name. I'm attaching both sheets of my workbook to illustrate what I'm doing. My goal is to use the 2nd sheet to analyze the data on the first sheet.

Under each year, there are 4 data points I'm currently working on:
  1. Count of the students enrolled in each grade (columns c & g)
  2. Count of the students who were in the next grade in the following year (columns d & h)
  3. Count of the students who were in the same grade the following year (columns e & i)
  4. Count of the students who were not enrolled in any grade in the following year (columns f & j)
In Step 2, I'm using the SumProduct function (this is my first experience with this function so I'm not sure I completely understand it's proper usage) to determine the names who were in the following grade in the next year. I think the issue lies in my not understanding how the function treats blank cells vs a "0" in the cell contents. The function seems to work fine on other grades but I use zero to designate Kindergarten while other numbers represent the 1st, 2nd, etc grades. If you will look at D4 it shouldn't be larger than C4 but I know it has something to do with Row 10 on the "Student List" worksheet because this student was not enrolled in 0 in 1987 but was enrolled in 1 in 1988.

Student Retention Worksheet - Public.xlsx
ABCDEFGH
1FirstLastDup Proof19871988
2Fname1Lname1Unique01
3Fname2Lname2Unique2
4Fname3Lname3Unique12
5Fname4Lname4Unique12
6Fname5Lname5Unique23
7Fname6Lname6Unique3
8Fname7Lname7Unique1
9Fname8Lname8Unique11
10Fname9Lname9Unique1
11Fname10Lname10Unique0
12Fname11Lname11Unique12
Student List
Cell Formulas
RangeFormula
C2:C12C2=IF(COUNTIFS($A$2:$A$10011,$A2,$B$2:$B$10011,$B2)>1,"Duplicate","Unique")


Student Retention Worksheet - Public.xlsx
ABCDEFGHIJ
119871988
2TotalsPromotedRetainedTurnoverTotalsPromotedRetainedTurnover
3Total Students86119009
40120-11001
5153113003
6211004004
7310011001
8400000000
9500000000
10600000000
11700000000
12800000000
13900000000
141000000000
151100000000
161200000000
Totals
Cell Formulas
RangeFormula
C3:J3C3=SUM(C4:C16)
C4:C16,G4:G16C4=COUNTIF('Student List'!D$2:D$10011,$A4)
D4:D16,H4:H16D4=SUMPRODUCT(--('Student List'!D$2:D$10011=$A4),--('Student List'!H$2:H$10011='Student List'!D$2:D$10011+1))
E4:E16,I4:I16E4=COUNTIFS('Student List'!D$4:D$10011,$A4,'Student List'!H$4:H$10011,$A4)
F4:F16,J4:J16F4=C4-D4-E4


 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Try change:

Code:
=SUMPRODUCT(--('Student List'!D$2:D$10011=$A4),--('Student List'!H$2:H$10011='Student List'!D$2:D$10011+1))

to:

Code:
=COUNTIFS('Student List'!D$2:D$10011,$A4,'Student List'!H$2:H$10011,A4+1)
 
Upvote 0
Thank you! I don't know why I couldn't get that. Sometimes I can't see the forest for the trees.

Do you (or anyone else) have a suggestion on how to eliminate the blank columns on the "Student List" sheet? I'm having to leave them blank because when I copy the 4 columns (C-F) on the "Totals" worksheet to the next year, it advances all the column references by 4. This is fine for the references on that worksheet. But the references for the other sheet, only need advancing by 1. If adding the blank columns is the best way to do that, I don't mind but I figure I'm missing a simpler way.
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,130
Members
453,021
Latest member
Justyna P

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