How to skip "Blank" cell when calling "MONTH(@cell)" ?
In my sheet, there is a column called "Date" and the format is "Date". I want to count the number of all lines which are in a given month, like "Nov 2021" by calling:
=COUNTIF(Date:Date, MONTH(@cell)=11)
Cuz there are some Blank cell in the column, so it showed "Invalid Data Type".
How to fix it, any workaround?
Thanks.
Best Answer

It's pretty unintuitive, but you need an IFERROR inside the formula for it to ignore the blanks:
=COUNTIF(Date:Date, IFERROR(MONTH(@cell), 0) =11)
The IFERROR basically says if there's an error when finding the month from the date (in that there's no date value to get it from,) just assume the value is 0.
MONTH Function  Smartsheet Learning Center
By wrapping the MONTH function in an IFERROR function, the function will no longer produce an error.
This formula counts the number of values in the Date column that are equal to 11 (November).
Regards,
Jeff Reisman
Link: Smartsheet Functions Help Pages Link: Smartsheet Formula Error Messages
If my answer helped solve your issue, please mark it as accepted so that other users can find it later. Thanks!
Answers

It's pretty unintuitive, but you need an IFERROR inside the formula for it to ignore the blanks:
=COUNTIF(Date:Date, IFERROR(MONTH(@cell), 0) =11)
The IFERROR basically says if there's an error when finding the month from the date (in that there's no date value to get it from,) just assume the value is 0.
MONTH Function  Smartsheet Learning Center
By wrapping the MONTH function in an IFERROR function, the function will no longer produce an error.
This formula counts the number of values in the Date column that are equal to 11 (November).
Regards,
Jeff Reisman
Link: Smartsheet Functions Help Pages Link: Smartsheet Formula Error Messages
If my answer helped solve your issue, please mark it as accepted so that other users can find it later. Thanks!

Jeff, thanks for the great solution, works perfect! Thank you very much.
Help Article Resources
Categories
 All Categories
 14 Welcome to the Community
 10.8K Get Help
 65 Global Discussions
 69 Industry Talk
 385 Announcements
 3.6K Ideas & Feature Requests
 56 Brandfolder
 125 Just for fun
 50 Community Job Board
 464 Show & Tell
 40 Member Spotlight
 44 Power Your Process
 28 Sponsor X
 234 Events
 7.3K Forum Archives
Check out the Formula Handbook template!