Nested count if

Wishmaster89

Board Regular
Joined
Jan 10, 2022
Messages
77
Office Version
  1. 2021
  2. 2019
  3. 2016
Platform
  1. Windows
  2. MacOS
Hi Everyone

This is my first post here.

I have a formula where i am a list of learners, teacher names and an acheivement date. What i want to do is count how many learners are assigned to each teacher, thats the easy part -
Excel Formula:
=COUNTIF(B:B,G2)

If the learner does have an achievement date they need to stay in the teachers total figures until 1 month after their achievement date.
So column H needs to do a count of learners with no achievement date and those with an achievement date and up to 1 month after. Here is my attempt so far. Do i need to use Let?


Excel Formula:
=IF(COUNTIF(B:B,"<>"),IF(TODAY()>EOMONTH(D:D,1),"",COUNTIF(B:B,G2)),COUNTIF(B:B,G2))

Formula_v2.xlsx
ABCDEFGH
1learner IDTeacher Nameachievement dateteachertotals
21SamSam#VALUE!
32Sam2/1/22Bob#VALUE!
43BobGary#VALUE!
54BobJames#VALUE!
65Gary12/1/21Ben#VALUE!
76Bruce
87Gary
98Gary11/1/21
109Bruce
1110Sam
1211James4/1/22
1312Ben12/1/21
14
Sheet1
Cell Formulas
RangeFormula
H2:H5H2=IF(COUNTIF(B:B,"<>"),IF(TODAY()>EOMONTH(D:D,1),"",COUNTIF(B:B,G2)),COUNTIF(B:B,G2))
H6H6=IF(COUNTIF(B:B,"<>"),IF(TODAY()>EOMONTH(D:D,1),"",COUNTIF(B:B,G6))*COUNTIF(B:B,G6))


On a separate note, can anyone please tell me why "value is false" in the formula bar is always greyed out, it happens all the time for me, I am using Mac OS version.
 

Attachments

  • Screenshot 2022-01-10 at 19.47.11.png
    Screenshot 2022-01-10 at 19.47.11.png
    148.3 KB · Views: 11
Last edited by a moderator:

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".
Easily achieved with Power Query also called Get and Transform Data and found on the Data Tab

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Removed Columns" = Table.RemoveColumns(Source,{"Column1"}),
    #"Grouped Rows" = Table.Group(#"Removed Columns", {"Teacher Name"}, {{"Count of Students", each Table.RowCount(_), Int64.Type}})
in
    #"Grouped Rows"
 
Upvote 0
Thanks but i don't have that tab, i am using excel on mac. Is there no way to it with a normal formula?
 
Upvote 0
Possibly, but not in my wheelhouse. Good Luck. I'm out.

BTW: I offered that solution as you had indicated in your profile that you were using Windows operating system.
 
Upvote 0
With cell I1 = TODAY(), you can use the following formula beginning in H2 and copied down as needed:
=SUMPRODUCT(($G2=$B:$B)*(($I$1<=$D:$D)+($D:$D=0)))

Hope that helps!

Regards,
Ken
 
Upvote 0
With cell I1 = TODAY(), you can use the following formula beginning in H2 and copied down as needed:
=SUMPRODUCT(($G2=$B:$B)*(($I$1<=$D:$D)+($D:$D=0)))

Hope that helps!

Regards,
Ken

Hi Ken

That is amazing thank you so much. One question though, even though it does work, I don't understand how the code is saying to not count a learner 1 month after the acheivement date,
Excel Formula:
$I$1<=$D:$D)

It is just saying less than or equal to right?
 
Upvote 0
Another:

Book1 (version 1).xlsb
ABCDEFGH
1learner IDTeacher Nameachievement dateteachertotals
21SamSam3
32Sam2/1/2022Bob2
43BobGary1
54BobJames1
65Gary12/1/2021Ben0
76BruceBruce2
87Gary
98Gary11/1/2021
109Bruce
1110Sam
1211James4/1/2022
1312Ben12/1/2021
Sheet5
Cell Formulas
RangeFormula
H2:H7H2=COUNTIFS($B$2:$B$13,G2,$D$2:$D$13,">="&TODAY()-30)+COUNTIFS($B$2:$B$13,G2,$D$2:$D$13,"")
 
Upvote 0
You are right I did overlook the one month adjustment.

Ken
 
Upvote 0

Forum statistics

Threads
1,215,874
Messages
6,127,473
Members
449,384
Latest member
purevega

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