Forum Discussion
averageif help
Seanm1525 One problem at a time....
You are using AVERAGEIF, not AVERAGEIFS. The syntax for AVERAGEIF (no "S") is:
AVERAGEIF(range, criteria, [average_range])
Note that when "range" and "average_range" are different, the range to average is the 3rd parameter, not the 1st, as you wrote it.
Also, the criteria parameter is a string that contains an optional comparison and a value.
So the formula in R8 should be:
=AVERAGEIF(StudentRepresentatives[Elected], "Yes", StudentRepresentatives[Post-Secondary Years])
or
=AVERAGEIFS(StudentRepresentatives[Post-Secondary Years], StudentRepresentatives[Elected], "Yes")
The equal sign -- which would be written "=Yes" -- is optional because it is implied.
-----
PS.... It would be prudent to wrap IFERROR around the AVERAGEIF[S] expression, just in case there are no rows that meets your criterion. For example:
=IFERROR(AVERAGEIFS(StudentRepresentatives[Post-Secondary Years], StudentRepresentatives[Elected], "Yes"), "")
- Seanm1525Jan 05, 2021Copper Contributor
Thank you, JoeUser2004! I didn't realize I had put averageifs instead of averageif. That was a typo. I'll try your suggestion on the iferror.
- SergeiBaklanJan 05, 2021Diamond Contributor
As JoeUser2004 mentioned you may use both, just order of parameters will be different.