Inserting a formula that returns the number of days left in a month

Insert the following formula into a cell:

DATEDIF(TODAY(),EOMONTH(A1,-1),"D")

So, if today's date is March 9, 2025, the formula returns 22.

MacBook Air 13″, macOS 15.3

Posted on Mar 9, 2025 6:43 PM

Reply
Question marked as Top-ranking reply

Posted on Mar 10, 2025 7:35 AM

Are you sure your formula works?


If A1 is March 9, 2025 then EOMONTH(A1,-1) gives you February 28 not March 31 and DATEDIF will give an error because the first date is later than the second. You need to change the -1 to a 0.


Your formula uses TODAY() in part of it and a reference to cell A1 in another part. The formula (after changing the -1 to a 0) will give you the correct answer as long as A1 is in the same month as TODAY, but not otherwise. Why not use A1 in both places or TODAY() in both places?


=DATEDIF(TODAY(),EOMONTH(TODAY(),0),"D")


6 replies
Question marked as Top-ranking reply

Mar 10, 2025 7:35 AM in response to EnaChaCha

Are you sure your formula works?


If A1 is March 9, 2025 then EOMONTH(A1,-1) gives you February 28 not March 31 and DATEDIF will give an error because the first date is later than the second. You need to change the -1 to a 0.


Your formula uses TODAY() in part of it and a reference to cell A1 in another part. The formula (after changing the -1 to a 0) will give you the correct answer as long as A1 is in the same month as TODAY, but not otherwise. Why not use A1 in both places or TODAY() in both places?


=DATEDIF(TODAY(),EOMONTH(TODAY(),0),"D")


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Inserting a formula that returns the number of days left in a month

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.