Formula- need to Sum OR Average based on another cell
I need some help with a formula. I have:
=IF([Goal Calculation]@row = "sum", SUM([Quarter 1]@row:[Quarter 4]@row,IF([Goal Calculation]@row = "average", avg([Quarter 1]@row:[Quarter 4]@row))))
The problem is it is only updating to reflect SUM. If I change it to AVERAGE, the cell goes blank. So I switched it and put AVERAGE first and that worked, but then SUM went blank. So it's only reading the first part of the formula.
Any advice?
Best Answer
-
Try your formula with the modification. The IF statements needed to be separated with more the the comma, I believe its because the SUM function needed to be closed before starting the next.
=IF([Goal Calculation]@row = "sum", SUM([Quarter 1]@row:[Quarter 4]@row), IF([Goal Calculation]@row = "average", AVG([Quarter 1]@row:[Quarter 4]@row)))
Answers
-
Try your formula with the modification. The IF statements needed to be separated with more the the comma, I believe its because the SUM function needed to be closed before starting the next.
=IF([Goal Calculation]@row = "sum", SUM([Quarter 1]@row:[Quarter 4]@row), IF([Goal Calculation]@row = "average", AVG([Quarter 1]@row:[Quarter 4]@row)))
-
Perfect! Thank you SO much!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.8K Get Help
- 434 Global Discussions
- 138 Industry Talk
- 470 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 65 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!