SumIfs Current Month

Ally
Ally ✭✭✭
edited 12/09/19 in Formulas and Functions

Hello,

I am trying to sum hours noted in the children of a row (Total Hours per Project) if the current month is noted in another cell (Week Ending With).  Here is what I have: 

=SUMIFS(CHILDREN([Total Hours per Project]1, [Week Ending With]:[Week Ending With], MONTH(@cell) = MONTH(TODAY()))

and I continue to receive a result of #unparseable.

Thank you in advance for your help!

Ally

Comments

  • Chris McKay
    Chris McKay ✭✭✭✭✭✭

    Hi Ally,

    Unfortunately, SUMIFS does not work with dates. Crazy huh?

    However, that's not why you're receiving an error. SUMIFS also need to sum and compare ranges of the same size. Because you're using a variable SUM range (children of [Total Hours per Project]1) and the whole Week Ending With column, it is falling in a big heap.

    You're kind of on the right track though. We just need to do a few things to help Smartsheet along:

    1. Create another Parent Count column (you can hide it if you wish) that has the following formula: =COUNT(PARENT([Total Hours per Project]1))
    2. Then drag it down the column as far as your data extends.
    3. This now means we can compare apples with apples as you can sum the whole Total Hours per Project column based on criteria in the Parent Count column we just created (i.e. a count of 1 indicating it's a child row)
    4. Now assuming that you're using a US date format (MM/DD/YY), we can cheat SUMIFS into working with dates by using the LEFT and MID functions to extract the month from your Week Ending With column.
    5. Create a new Month column (that can also be hidden) and enter this formula: =IF(LEFT([Week Ending With]1, 2) < 10, MID([Week Ending With]1, 2, 1), LEFT([Start Date]2, 2)). This formula needs to account for the leading 0 displayed for January - September (groan).
    6. Drag this formula down the column as far as your data extends.

    Now that we've set things up, your end formula will end up looking something like this:



    =SUMIFS([Total Hours per Project]:[Total Hours per Project], [Parent Count]:[Parent Count], 1, Month:Month, VALUE(@cell) = MONTH(TODAY()))

    Hope this helps smiley.

    Kind regards,

    Chris McKay 

  • Ally
    Ally ✭✭✭

    Chris,

    Wow, I don't know if I ever would have come up with your recommendations, so thanks for putting the time in to write all of that out!  I created the Parent count column and dragged your recommended formula throughout the appropriate fields on the sheet.  Then I added a Month column and entered your suggested formula. The only issue (so far) that I'm running into is that the formula you recommended for the Month column: =IF(LEFT([Week Ending With]1, 2) < 10, MID([Week Ending With]1, 2, 1), LEFT([Start Date]2, 2)) is returning an #UNPARSEABLE value.  Any ideas what needs to be changed? 

    Thanks so much for your help!

    Ally

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!