You need to sign in to do that
Don't have an account?

determine last day of previous month using a date field
For example, using today, can I find the number of days in the month prior to today.
I can find the previous month MONTH(Today()) -1, but what is the last day of that month?
Ideas on how I can do this?
How about
DATE(YEAR(TODAY()),MONTH(TODAY()),1)-1
Might be an easier way, but that one works.
All Answers
How about
DATE(YEAR(TODAY()),MONTH(TODAY()),1)-1
Might be an easier way, but that one works.
A variation on the last post to get the correct year. I have tested the first one using one date field to enter a date, and a second formula field to calculate the end of the month. I have not tested the second one for the date of the last day of the previous month.
replace today() with date field or variable:
Selected month:
if(month(today())=12,DATE(year(today())+1,1,1)-1,DATE(year(today()),Month(today())+1,1)-1)
Previous month:
if(month(today())=1,DATE(year(today())-1,12,31),DATE(year(today()),Month(today()),1)-1)