# Looking for help with countif formula

✭✭✭
edited 09/28/21

I'm having some trouble with a countif formula, looking for some assistance.

My goal here is to count the number of time the Created Date is last month and that the service type is "Trade Database - Add Part Number(s)"

When I enter the formula below it works great!

=IF(MONTH(TODAY()) = 1, COUNTIFS({Genie Archive Created Date}, IFERROR(MONTH(@cell), 0) = 12, {Genie Archive Created Date}, IFERROR(YEAR(@cell), 0) = YEAR(TODAY()) - 1), COUNTIFS({Genie Archive Created Date}, IFERROR(MONTH(@cell), 0) = MONTH(TODAY()) - 1, {Genie Archive Created Date}, IFERROR(YEAR(@cell), 0) = YEAR(TODAY()))), {Genie Archive Service Type}, "Trade Database - Add Part Number(s)"

I now need to add the following to the above

I tied the two of them together as follows:

=IF(MONTH(TODAY()) = 1, COUNTIFS({Genie Archive Created Date}, IFERROR(MONTH(@cell), 0) = 12, {Genie Archive Created Date}, IFERROR(YEAR(@cell), 0) = YEAR(TODAY()) - 1), COUNTIFS({Genie Archive Created Date}, IFERROR(MONTH(@cell), 0) = MONTH(TODAY()) - 1, {Genie Archive Created Date}, IFERROR(YEAR(@cell), 0) = YEAR(TODAY()))), {Genie Archive Service Type}, "Trade Database - Add Part Number(s)")

When I do I get an UNPARSABLE error message.

Tags:

• ✭✭✭✭✭✭

Try this one...

=COUNTIFS({Genie Archive Service Type}, "Trade Database - Add Part Number(s)", {Genie Archive Created Date}, AND(IFERROR(MONTH(@cell), 0) = IF(MONTH(TODAY()) = 1, 12, MONTH(TODAY()) - 1), IFERROR(YEAR(@cell), 0) = YEAR(TODAY()) - IF(MONTH(TODAY()) = 1, 1)))

• ✭✭✭✭✭✭

Hi JP

If I've counted the brackets correctly, I think one of the closing brackets after the last TODAY function needs to be deleted.

e.g., try replacing YEAR(TODAY()))) with YEAR(TODAY())) and see how that goes?

Hope this helps and that you have a great day,

Jason Albrecht MBA, MBus(AppFin), DipFinMgt

LinkedIn profile - Open to work

• ✭✭✭

Unfortunately not the solution

• ✭✭✭✭✭✭

Try this one...

=COUNTIFS({Genie Archive Service Type}, "Trade Database - Add Part Number(s)", {Genie Archive Created Date}, AND(IFERROR(MONTH(@cell), 0) = IF(MONTH(TODAY()) = 1, 12, MONTH(TODAY()) - 1), IFERROR(YEAR(@cell), 0) = YEAR(TODAY()) - IF(MONTH(TODAY()) = 1, 1)))

• ✭✭✭

Thank you Paul!

I have so much to learn yet, but excited to do so. You and the others have been an amazing asset in this community.

• ✭✭✭✭✭✭

Happy to help. 👍️

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!