Excel Unplugged

Last day of previous month formula in Excel


On many occasions we would like to somehow get the dates belonging to the last day of current, previous or any other month, the first day of this month or any day of the current month. This post will show you a nice trick how to do that. Whereas for the last dates of the given month the go to function in Excel would have to be EOMONTH (End Of Month), we will show a neat trick how to do this with a well-known Excel function called DATE.

First off, let’s say we would like to get the date belonging to the last day of the previous and the last day of the current month.


Now with EOMONTH that would go

Last day of the previous month =EOMONTH(TODAY(),-1)

Last day of the current month =EOMONTH(TODAY(),0)

You can fiddle with the last argument to get to any month between Jan 1900 and Dec 9999. Keep in mind, that the EOMONTH function gives you only the serial number of the date, which you then have to format as a date.

The DATE function

It should be said that the DATE function gives you more leeway than EOMONTH since it can return literally any day of the month you choose.

=DATE(year,month,day) gives you the date you need or better yet the serial number belonging to the date you need.

For Example =DATE(2014,10,28) gives you 12/28/2014

But here’s a kicker =DATE(2014,10,0) gives you 9/30/2014

So with DATE function, these would be the two formulas (considering our initial goal)

Last day of the previous month =DATE(YEAR(TODAY()),MONTH(TODAY()),0)

Last day of the current month =DATE(YEAR(TODAY()),MONTH(TODAY())+1,0)

Now this trick with the zero as the last argument of the date function is genius. But even better, it can even go into negative. So you can do =DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY())-2) gives you the date of two days ago.

Here are a few more examples of how you can use both functions

Last day of previous month formula in Excel

I can already hear you screaming what about the +1 on the month argument of the DATE function if the current month is December. Well you needless worry about that, you can easily go over 12 and the DATE function simply returns the month using the remainder after the number has been divided by 12 and even adds the number of years it get’s from the division by 12 to the year argument. Simply Brilliant and a great way towards that ever elusive Eternal Happiness.

Comments 9

  1. Barry says:

    =Today()-2 is a slightly easier/quicker way to get the date 2 days ago.

  2. Ken says:

    How would you calculate the first day of any prior month given TODAY()?

    1. To make it interesting and bulletproof I would go with
      Now only change the -1 to get to months further back…
      Hope this brings you one step closer to eternal happiness 🙂

  3. louise says:

    can you tell me how to get the next working day after the 20th for the previous month when the current date is shown in cell A1


      This juat might be the longest formula that will get you there but it is bulletproof…

  4. louise says:

    Thank you very much.

    is it possible to add on to an existing formula -1 work day ?

    1. You could use the Workday function like =Workday(formula above,-1) and you could even add holidays as the third optional argument…

  5. louise says:


    I should have said the 1st working day after 19th in my original request but I’m not sure how to adjust the formula?!

    if A1=15/12/16 and I add -1 to the formula it provides the answer as Sunday 20 November but I would expect Friday 18 November or Monday 21st November

    is it possible to get the expected answer?

    1. The 18’th has me somewhat confused since it’s not after the 19th? If you really want the first workday after the 19th use the formula from before but change all 21 to 20, 22 to 21 and 23 to 22…

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: