COUNTIFS FORMULA when date is today or in the past

I'm having invalid operation being returned on this formula. can anyone help please?

=COUNTIFS(@cell <= TODAY([Column6]2), {TIME RECORDING 7}, $[Column7]@row)

I'm trying to count the number of times a word appears in a column when the date is today or in the past.

Column6]2 is a date column showing todays date and is linked cell to my date master sheet.

Column7]@row is the cell populated with the time recording word to be counted.

Hope that makes sense? Many thanks in advance

Answers

  • SoS | Dan Palenchar
    SoS | Dan Palenchar ✭✭✭✭✭✭

    Hello @Ed Gadd

    It appears you have some issues with the formula structure.

    • TODAY([Column6]2) will not work since you are referencing a date column where there should be a number (See below)
    • The use of @cell does not appear to be correct. If you are trying to evaluate if a date is less than today you would structure this is =COUNTIFS([Date Field] < TODAY(),…)
    • The second portion with the cross sheet reference needs a way to evaluate the range you selected which I assume is a column. This would be something like …{TIME RECORDING 7}, CONTAINS([Column7]@row, @cell)

    However, I think you will be better off using COUNT(COLLECT()). I would try something like this to start. I am writing this off the type of my head and not sure of your Sheet structure so I don't expect it to work straight away:

    =COUNT(COLLECT({TIME RECORDING 7}, {TIME RECORDING 7}, CONTAINS([Column7]@row, @cell), [Column6]:[Column6], IFERROR(@cell < TODAY(), 0)))

    School of Sheets (Smartsheet Partner)

    If my answer helped please accept and react w/💡Insightful, ⬆️ Vote Up, ❤️Awesome!

  • Ed Gadd
    Ed Gadd ✭✭✭✭

    Hi @SoS | Dan Palenchar

    Thanks for the help. The formula is close, however everything comes out as a 1 irrespective if the words appear in the column once, twice etc or not at all?

    Thanks again for the help

  • Ed Gadd
    Ed Gadd ✭✭✭✭

    Hi all,

    I'm still struggling with this formula, can anyone help. i only seems to get one as a response.

    =COUNT(COLLECT({TIME RECORDING 7}, {TIME RECORDING 7}, CONTAINS($[Column7]@row, @cell), $[Column6]$2, IFERROR(@cell < = TODAY (), 0)))

    [Column6]$2 is a cell which contains todays date.

    Thanks in advance for any advice.

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!