Extract a year from a date column and count current year
I have a date column titled "Date Triaged." I want to count all values in that column for the current year.
I tried this formula but it does not work, it returns #INVLID DATA TYPE. Please help.
=COUNTIF([Date Triaged]:[Date Triaged], YEAR(@cell) = YEAR(TODAY()))
Best Answer
-
Hi @Doris F
Try wrapping an IFERROR around the YEAR function that's looking @cell. The reason we need to add this in is because the @cell is looking into every single cell in the Date Triaged column, including blank cells or cells that contain text (which would return an error, since blank cells don't have any Year).
=COUNTIF([Date Triaged]:[Date Triaged], IFERROR(YEAR(@cell), 0) = YEAR(TODAY()))
Cheers,
Genevieve
Answers
-
Hi @Doris F
Try wrapping an IFERROR around the YEAR function that's looking @cell. The reason we need to add this in is because the @cell is looking into every single cell in the Date Triaged column, including blank cells or cells that contain text (which would return an error, since blank cells don't have any Year).
=COUNTIF([Date Triaged]:[Date Triaged], IFERROR(YEAR(@cell), 0) = YEAR(TODAY()))
Cheers,
Genevieve
-
Thank you so much @Genevieve P. . I really appreciate the correction and the added bonus (the explanation)!!!!!
-
No problem at all! I'm glad I could help. 🙂
Help Article Resources
Categories
Check out the Formula Handbook template!