Countifs for a specific month

The AI-generated formula shows an invalid data type. I'm not sure what is wrong. What I want to do is count the number of items that are good for the month of December.

=COUNTIFS([Fault Severity]:[Fault Severity], "good", MONTH([Last Update]:[Last Update]), 12)

Answers

  • Kerry St. Thomas
    Kerry St. Thomas ✭✭✭✭✭✭
    edited 12/04/24

    I am not absolutely certain, but I think the issue is you're trying to do a MONTH evaluation (parsing of something with type Date) in what will eventually be a Text column. I suggest you create a helper column of "Last Update"

    =MONTH([Last Update]@row)

    Then you can subtly change your formula to be:

    =COUNTIFS([Fault Severity]:[Fault Severity],"good",[Last Update Month]:[Last Update Month],12)

    If this is a sheet that holds data from other years, remember this will count ALL the Decembers and not just THIS December - so be sure that's what you're aiming for with your specific use case.

    Good luck!

    If this answer resolves your question, please help the Community by marking it as an accepted answer. I'd also be grateful for your response - "Insightful"or "Awesome" reactions are much appreciated. Thanks!

  • Jeremy_D
    Jeremy_D ✭✭✭

    An invalid data type is usually due to the type of column you are inputting the formula in not being able to show the answer of the formula. It's likely that you've inputted this formula into a date column? You'll need to change it to a Text/Number column.

    Hope that helps unless I've misunderstood.

  • Follow-up question: I got the right formula, and the column helper works. If I move to a different month, the statistical count from the previous month will go to zero, and the count will apply to the current month. How can I retain the statistical count from the last month?

  • Kelly Moore
    Kelly Moore ✭✭✭✭✭✭

    @Leod13

    I'm not sure exactly what you're measuring and how your data is arranged however, whenever I need a snapshot of data that will change at a later point, I create a second sheet to act as a log, or archive. I move or copy the relevant rows to the Log Sheet at whatever frequency is needed (Either Move Row or Copy Row automation). You would want to COPY ROW. I can then create Reports or formulas that will extract the data I need using the Log Sheet info.

    Would this work for you?
    Kelly

    https://help.smartsheet.com/articles/2479626-automatically-copy-rows-between-sheets

    https://help.smartsheet.com/articles/2480261-move-rows-action

    https://www.youtube.com/watch?v=91p1_753fjE

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!