Forum Discussion
dpeck
Jun 24, 2020Copper Contributor
Need help with a COUNTIFS formula
I'm working on a spreadsheet for state reporting (I work for a school district) and I need to get the unduplicated number of students who received a suspension or in-house suspension. I've marked...
- Jun 25, 2020Try this formula:
=SUM(COUNTIFS(A2:A57,”X”,
P2:P57,{“SUS”,”IH”}))
dpeck
Jun 25, 2020Copper Contributor
Twifoo Thank you, thank you, thank you!!! That worked beautifully!!
Twifoo
Jun 25, 2020Silver Contributor
You’re welcome!
- dpeckJun 25, 2020Copper ContributorNow, how about if I need to count Incident codes from 3 different columns?
I tried to tweak the previous one, but it didn't work. What I originally had was:
=COUNTIFS(T2:T10,"300",W2:W10,"300",Z2:Z10,"300") - that brought up 0.
I tried =SUM(COUNTIFS({T2:T10,W2:W10,Z2:Z10},"300")) but that caused an error.
I tried =SUM(COUNTIFS(T2:T10,W2:W10,Z2:Z10,{"300"})) - that brought up 0
So basically, I need a total of all the 300 codes from column T, W & Z. Is that possible?- SergeiBaklanJun 25, 2020Diamond Contributor
Two ways. If codes in T, W and Z columns are numbers, when as Twifoo suggested. If codes are texts when
=COUNTIFS(T2:T10,CHAR(173) & "300", W2:W10,CHAR(173) & "300", Z2:Z10,CHAR(173) & "300") or =SUMPRODUCT( (T2:T10 = "300")* (W2:W10 = "300")* (Z2:Z10 = "300") )
COUNIF(S) converts criteria parameter defined as texts into number where possible, adding of soft hyphen is workaround. But SUMPRODUCT is more reliable from my point of view.
- TwifooJun 25, 2020Silver ContributorIt seems 300 in your criteria must be a number. If so, remove the quotes around it.