any way to tell the last day of the month? when the month is a var?

  • Thread starter Thread starter jim sturtz
  • Start date Start date
J

jim sturtz

ie, if a a1 has 10/9/6 as a date, then month will give me the numeric month
into say a2, need to now how to find 31 into a3 or
" 4/6/6 "
30 "

thanks.

jim
 
Several ways

=DAY(DATE(YEAR(A1),MONTH(A1)+1,0))

or with Analysis Toolpak

=DAY(EOMONTH(A1,0))

or my favorite for unintelligibility!

=DAY(A1-DAY(A1)+32-DAY(A1-DAY(A1)+32))
 
ie, if a a1 has 10/9/6 as a date, then month will give me the numeric month
into say a2, need to now how to find 31 into a3 or
" 4/6/6 "
30 "

thanks.

jim

=A1-DAY(A1)+32-DAY(A1-DAY(A1)+32)

will give the date of the last day of the month that is in A1.

If you want only the day number, then:

=DAY(A1-DAY(A1)+32-DAY(A1-DAY(A1)+32))

or

for the date:
=DATE(YEAR(A1),MONTH(A1)+1,0)

for just the day:

=DAY(DATE(YEAR(A1),MONTH(A1)+1,0))


--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top