AVERAGEIF formula with 2 sets of criteria
Hi! I was able to use the following formula to pull data based on 1 set of criteria.
=AVERAGEIF({Range 1}, MONTH(@cell) = 7, {Range 2})
So, if range 1 includes data for the month of July, return the average of that data set in range 2.
However, now I want to further segment by type of data. But my formula is not working. What should I change?
=AVERAGEIF({Range 1}, MONTH(@cell) = 7, {Range 3}, "Google", {Range 2})
I'm trying to get the average of data that is in the month of July AND is identified as Google in range 3, then return the average of that data set in range 2.
Can anyone please help me figure out what I have wrong?
Thanks!
Cindi
Best Answer
-
No, you just have the range you want to sum placed at the wrong end of the formula:
SUMIFS(range to sum, criterion_range1, criterion1, criterion_range2, criterion2)
AND is kind of built into SUMIFS and COUNTIFS. by default, all conditions must be met for it to add or count.
If {Range 2} contains the values to add up:
=SUMIFS({range 2}, {Range 1}, MONTH(@cell) = 7, {Range 3}, "Google")
Regards,
Jeff Reisman
Link: Smartsheet Functions Help Pages Link: Smartsheet Formula Error Messages
If my answer helped solve your issue, please mark it as accepted so that other users can find it later. Thanks!
Answers
-
AVERAGEIF only works with one range. Unfortunately, we don't have an AVERAGEIFS yet.
What you have to do is use a SUMIFS on the two ranges to add up all the values, and then divide that by a COUNTIFS on the same ranges.
Regards,
Jeff Reisman
Link: Smartsheet Functions Help Pages Link: Smartsheet Formula Error Messages
If my answer helped solve your issue, please mark it as accepted so that other users can find it later. Thanks!
-
Thank you Jeff. It still returns "Invalid Operation." Do I need to make an "and" in there somewhere?
=SUMIFS({Range 1}, MONTH(@cell) = 7, AND {Range 3}, "Google", {Range 2})
-
No, you just have the range you want to sum placed at the wrong end of the formula:
SUMIFS(range to sum, criterion_range1, criterion1, criterion_range2, criterion2)
AND is kind of built into SUMIFS and COUNTIFS. by default, all conditions must be met for it to add or count.
If {Range 2} contains the values to add up:
=SUMIFS({range 2}, {Range 1}, MONTH(@cell) = 7, {Range 3}, "Google")
Regards,
Jeff Reisman
Link: Smartsheet Functions Help Pages Link: Smartsheet Formula Error Messages
If my answer helped solve your issue, please mark it as accepted so that other users can find it later. Thanks!
-
Got it! Thanks so much for the explanation, Jeff.
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 65.2K Get Help
- 445 Global Discussions
- 143 Industry Talk
- 476 Announcements
- 5K Ideas & Feature Requests
- 84 Brandfolder
- 150 Just for fun
- 71 Community Job Board
- 488 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 301 Events
- 36 Webinars
- 7.3K Forum Archives