Incorrect argument set error message on countif formula
I'm working on a project that distributes free car seats and we collect data from family members for up to 4 children per family depending on their car seat needs. One entry may include 1, 2, 3, and/or 4 children and we ask for specific demographic data per child. Again, all collected in entry so across multiple columns for one row.
In this scenario I am trying to calculate how many children were identified as having a certain racial identity within a certain time frame. It works when I write the formula without a time frame like this:
=COUNTIFS([Child Racial Identity 1]:[Child Racial Identity 4], "White")
But once I add a date range it says incorrect argument set and I don't understand why the addition of a date range would create this error message.
=COUNTIFS([Child Racial Identity 1]:[Child Racial Identity 4], "White", [Date Distributed]:[Date Distributed], AND(@cell >= DATE(2023, 10, 1), @cell <= DATE(2024, 9, 30)))
What am I doing wrong?
Best Answer
-
It should work if you expand your AND into 2 criteria instead of one:
=COUNTIFS([Child Racial Identity 1]:[Child Racial Identity 4], "White", [Date Distributed]:[Date Distributed], >=DATE(2023, 10, 1), [Date Distributed]:[Date Distributed], <=DATE(2024, 9, 30))
I also just realized your range is four columns for racial identity. So your formula does work, but I thought it was just one range. For a range of columns, you'd have to sum up each of the racial identities separately, like this.
=COUNTIFS([Child Racial Identity 1]:[Child Racial Identity 1], "White", [Date Distributed]:[Date Distributed], AND(@cell >= DATE(2023, 10, 1), @cell <= DATE(2024, 9, 30))) + COUNTIFS([Child Racial Identity 2]:[Child Racial Identity 2], "White", [Date Distributed]:[Date Distributed], AND(@cell >= DATE(2023, 10, 1), @cell <= DATE(2024, 9, 30))) + COUNTIFS([Child Racial Identity 3]:[Child Racial Identity 3], "White", [Date Distributed]:[Date Distributed], AND(@cell >= DATE(2023, 10, 1), @cell <= DATE(2024, 9, 30))) + COUNTIFS([Child Racial Identity 4]:[Child Racial Identity 4], "White", [Date Distributed]:[Date Distributed], AND(@cell >= DATE(2023, 10, 1), @cell <= DATE(2024, 9, 30)))
Jason Tarpinian - Sevan Technology
Smartsheet Aligned Partner
Answers
-
It should work if you expand your AND into 2 criteria instead of one:
=COUNTIFS([Child Racial Identity 1]:[Child Racial Identity 4], "White", [Date Distributed]:[Date Distributed], >=DATE(2023, 10, 1), [Date Distributed]:[Date Distributed], <=DATE(2024, 9, 30))
I also just realized your range is four columns for racial identity. So your formula does work, but I thought it was just one range. For a range of columns, you'd have to sum up each of the racial identities separately, like this.
=COUNTIFS([Child Racial Identity 1]:[Child Racial Identity 1], "White", [Date Distributed]:[Date Distributed], AND(@cell >= DATE(2023, 10, 1), @cell <= DATE(2024, 9, 30))) + COUNTIFS([Child Racial Identity 2]:[Child Racial Identity 2], "White", [Date Distributed]:[Date Distributed], AND(@cell >= DATE(2023, 10, 1), @cell <= DATE(2024, 9, 30))) + COUNTIFS([Child Racial Identity 3]:[Child Racial Identity 3], "White", [Date Distributed]:[Date Distributed], AND(@cell >= DATE(2023, 10, 1), @cell <= DATE(2024, 9, 30))) + COUNTIFS([Child Racial Identity 4]:[Child Racial Identity 4], "White", [Date Distributed]:[Date Distributed], AND(@cell >= DATE(2023, 10, 1), @cell <= DATE(2024, 9, 30)))
Jason Tarpinian - Sevan Technology
Smartsheet Aligned Partner
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 139 Industry Talk
- 471 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 496 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!