How can I get the name of the last month?


So I couldn’t think of a way to get last month’s name, is that possible? I know that by doing the formula: MonthName(Today()) I can get the current date and current month, but can I get the name of last month? So if today we are in May, how can I get April out of a formula using “Today()”?


Here it is. It works even if current month is January:


That’s a much better way to do it, I had come up with the following :sweat_smile:

if(Day(Today())=1 OR Day(Today())=2 OR Day(Today())=3,MonthName(Today()-15),MonthName(Today()-30))


If I use “Today()” instead of “Now()”, it works too, right? Also, do you know if I can get the number of the week based on the month? Like, if it’s day 15 the formula returns “3” because it’s the 3rd week in the month


Yes, you can use Today() with no difference in this case.

There is a formula with that name: WeekNumber(), but it returns week number in year. So, week number in month will be more complicated. You need to calculate it based on first day in month. This is a weekday number of first day:

Date(Year(Today()), Month(Today()) , 1).Weekday()

And this is a current day number in month:


So, the first week in month was only 8 - FIRST_DAY_NUMBER days. All other days except first week should be divided by 7 with round up, to get whole number of week.

Final formula is:

Ceiling((Day(Today()) - (8 - Date(Year(Today()), Month(Today()) , 1).Weekday())) / 7) + 1

Replace Today() everywhere with date you prefer.

1 Like

Wow man! Thanks, I would have never thought of this, I’ll try it out and I report back on how it worked out


You are welcome! )
Note that Coda works with weeks starting from Sunday not Monday. If your locale works with Mondays, you should replace 8 by 9 in this formula.


Your formula worked just as expected, thanks a lot!

1 Like