Average of values if criteria is met in two other columns
Hello, I am trying to determine the average of values in one column (Days Open) if criteria in two other columns is met:
- (Date Closed) is from last month
- (Facility Name) is a specific dropdown option from this column
I can calculate average based upon date closed being from last month, but adding in the second criteria that the facility name from that row is specific text is giving me issue.
=AVERAGEIF(COLLECT({Days Open}, {Date Closed}, IFERROR(MONTH(@cell ), 0) = MONTH(TODAY()) - 1, {Facility}, FIND("NAME", @cell)))
Best Answer
-
Hey @shoey24
Change your AVERAGEIF to AVG. The COLLECT function is filtering the same as the IVERAGEIF function would
=AVG(COLLECT({Days Open}, {Date Closed}, IFERROR(MONTH(@cell ), 0) = MONTH(TODAY()) - 1, {Facility}, FIND("NAME", @cell)))
Will this work for you?
Kelly
Answers
-
Hey @shoey24
Change your AVERAGEIF to AVG. The COLLECT function is filtering the same as the IVERAGEIF function would
=AVG(COLLECT({Days Open}, {Date Closed}, IFERROR(MONTH(@cell ), 0) = MONTH(TODAY()) - 1, {Facility}, FIND("NAME", @cell)))
Will this work for you?
Kelly -
I am now getting an Invalid Data Type Error. I looked at the column for days open and it is all numbers that are calculated using a formula on the sheet. Date Closed only contains sates, and Facility is a list of 1-3 different facilities. I cannot find where the invalid data is coming from.
-
Immediately as I typed that out, I realized the problem was needing the end to be @cell) >0. It is working as intended now, thank you!
-
Help Article Resources
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
Check out the Formula Handbook template!