count "on time" dates

Nino
Nino
edited 12/09/19 in Smartsheet Basics

hi there,

I am trying to count all dates that are on time comparing my due date column and delivery date column...

tried countifs, but it wont let me compare the whole columns...

 

please help.

 

Thanks

nino

Screen Shot 2019-01-03 at 16.35.54.png

Comments

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    You'll need a helper column. In this example I'll make it a checkbox, but you can use whatever works best for you. In the checkbox column use an IF statement to compare the two dates and check the box if they are the same.

     

    =IF([First Date Column]@row = [Second Date Column]@row, 1)

     

    You can then use a COUNTIFS on the helper column to count your checkboxes.

     

    =COUNTIFS([Helper Column]:[Helper Column], 1)

  • L_123
    L_123 ✭✭✭✭✭✭

    This was fun.

     

    =COUNT(COLLECT(COLLECT(Start:End, Start:End, ISDATE(@cell)), COLLECT(Start:End, Start:End, ISDATE(@cell)), AND(INDEX(COLLECT(Start:End, Start:End, ISDATE(@cell)), MATCH(@cell, COLLECT(Start:End, Start:End, ISDATE(@cell)), true)) > INDEX(COLLECT(Start:End, Start:End, ISDATE(@cell)), MATCH(@cell, COLLECT(Start:End, Start:End, ISDATE(@cell)), true) + 1), MATCH(@cell, COLLECT(Start:End, Start:End, ISDATE(@cell)), true) / 2 = ROUND(MATCH(@cell, COLLECT(Start:End, Start:End, ISDATE(@cell)), true) / 2))))

     

    Not often you get the chance to do a nested collect.

     

    I recommend pauls solution however as mine can't handle duplicates in the dates :(

     

    Also the start column has to be directly to the left of the end column or it will break

     

     

  • L_123
    L_123 ✭✭✭✭✭✭

    =COUNT(COLLECT(COLLECT([Due Date]:Delivered, [Due Date]:Delivered, ISDATE(@cell)), COLLECT([Due Date]:Delivered, [Due Date]:Delivered, ISDATE(@cell)), AND(INDEX(COLLECT([Due Date]:Delivered, [Due Date]:Delivered, ISDATE(@cell)), MATCH(@cell, COLLECT([Due Date]:Delivered, [Due Date]:Delivered, ISDATE(@cell)), true)) > INDEX(COLLECT([Due Date]:Delivered, [Due Date]:Delivered, ISDATE(@cell)), MATCH(@cell, COLLECT([Due Date]:Delivered, [Due Date]:Delivered, ISDATE(@cell)), true) + 1), MATCH(@cell, COLLECT([Due Date]:Delivered, [Due Date]:Delivered, ISDATE(@cell)), true) / 2 = ROUND(MATCH(@cell, COLLECT([Due Date]:Delivered, [Due Date]:Delivered, ISDATE(@cell)), true) / 2))))

     

    Heres a copy that uses your column names

  • Mike Wilday
    Mike Wilday ✭✭✭✭✭✭

    I recommend adding the helper column as well. But you should modify Paul's formula for the helper column slightly to account for dates earlier than due dates. 

    =IF([Delivered]@row <= [Due Date]@row, 1)

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    Good suggestion, Mike. Thanks. I read "on time" as "same as" and went from there.

  • Brian W
    Brian W ✭✭

    I would also consider adding a check for blanks, because in this formula blanks will show up as as "on time".

    =IF(NOT(ISBLANK(Delivered@row)), IF(Delivered@row <= [Due Date]@row, 1))

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    Another good suggestion. That's what I get for not plugging it in to an actual sheet for testing. Haha.