Nov 02 2022 10:33 AM - edited Nov 02 2022 10:33 AM
Hey! I'm trying to create a count if statement that counts all cells in a column on a different sheet with values greater than 4. I need to refer to the column by name, not simply by the array of cells because there is a lot of movement happening in that column and want to ensure the formula doesn't break. Does anyone know of some example code or what type of equation can do this?
Nov 02 2022 11:05 AM
Solution=SUMPRODUCT((sheet2!$A$1:$I$1="header 2")*(sheet2!$A$2:$I$23>4))
You can try this formula.
This is "sheet2":
The formula returns the number of cells from "sheet2" that are under "header 2" and have a value greater 4.
Nov 06 2022 10:44 AM
@Quadruple_Pawn Hey that is super helpful! Is it also possible to add more conditions. So for example in the table below if I wanted to return the number of scores higher than 3, in smith's class, since the start of 2022, by referring to column labels/names, would that be possible to bake into one formula?
Score | Teacher | Date | |
Student 1 | 3.7 | Smith | 1/21/2022 |
Student 2 | 3.2 | Dylan | 3/9/2020 |
Student 3 | 2 | Smtih | 10/11/2019 |
Student 4 | 3.7 | Dylan | 5/6/2022 |
Student 5 | 2.1 | Allen | 9/7/2021 |
Student 6 | 4.8 | Dylan | 8/11/2022 |
Student 7 | 1.9 | Smith | 6/29/2022 |
Student 8 | 1.8 | Allen | 8/6/2022 |
Student 9 | 2.1 | Smith | 2/3/2022 |
Student 10 | 3.1 | Smith | 08/0/4/2022 |
Nov 06 2022 10:52 AM
Try
=COUNTIFS(INDEX($A$2:$ZZ$1000, 0, MATCH("Score", $A$1:$ZZ$1, 0)), ">3", INDEX($A$2:$ZZ$1000, 0, MATCH("Teacher", $A$1:$ZZ$1, 0)), "Smith", INDEX($A$1:$ZZ$1000, 0, MATCH("Date", $A$1:$ZZ$1, 0)), ">="&DATE(2022, 1, 1))
Nov 06 2022 11:27 AM
Nov 06 2022 11:46 AM
=SUMPRODUCT((B2:B11>3)*(C2:C11="Smith")*(D2:D11>=44562))
An alternative could be SUMPRODUCT.
Nov 06 2022 12:07 PM
=AVERAGEIFS($B$2:$B$11,$C$2:$C$11,G3,$D$2:$D$11,">=44562")
You can try this formula which refers to the unique list of teachers. The formula is in cell H3 and copied down in the example.
Nov 06 2022 12:10 PM - edited Nov 06 2022 01:21 PM
Yes:
=AVERAGEIFS(INDEX($A$2:$ZZ$1000, 0, MATCH("Score", $A$1:$ZZ$1, 0)), INDEX($A$1:$ZZ$1000, 0, MATCH("Date", $A$1:$ZZ$1, 0)), ">="&DATE(2022, 1, 1))
Nov 06 2022 12:41 PM
Nov 06 2022 01:22 PM
Sorry, I meant AVERAGEIFS instead of COUNTIFS. I have edited my previous reply.
Nov 07 2022 12:37 PM
Thank you so much for your help @Hans Vogelaar
Nov 08 2022 06:48 AM
Nov 08 2022 06:56 AM
See my reply to your private message.
Nov 08 2022 07:39 AM
See the version attached below.
I had to remove the trailing space from the end of some of the values. "Hardware" and "Hardware " don't match.