Date in an IF statement

L

LyndieBee

I'd like to be able to evaluate the current date and have the name of the
previous month display in a cell. For example if I'm in cell A1 I want the
statement to check today's date (March 8, 2005) and return last month's month
"April". Can I accomplish this with an IF statement? Any other function?
Many thanks, Lyndie
 
J

JulieD

Hi

i would have thought that last month's month was Feburary and next month's
month was April ... however, here's two options
- returns Feburary
=TEXT(EOMONTH(NOW(),-1),"mmmm")
- returns April
=TEXT(EOMONTH(NOW(),1),"mmmm")

Note, to use the EOMONTH function you need to have the Analysis Tool-Pak
add-in installed (tools / add-ins)

Cheers
JulieD
 
R

Ron Rosenfeld

I'd like to be able to evaluate the current date and have the name of the
previous month display in a cell. For example if I'm in cell A1 I want the
statement to check today's date (March 8, 2005) and return last month's month
"April". Can I accomplish this with an IF statement? Any other function?
Many thanks, Lyndie

To return the previous month,

=TEXT(A1-DAY(A1),"mmmm")

To return the name of the next month:

=TEXT(A1-DAY(A1)+33-DAY(A1-DAY(A1)+32),"mmmm")

Simpler might be to just compute a date in the month, and format the cell as
"mmmm"

Then the above formulas become:

Previous month:

A1-DAY(A1)

Next month:

A1-DAY(A1)+33-DAY(A1-DAY(A1)+32)


--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

Top