View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.misc
David Biddulph[_2_] David Biddulph[_2_] is offline
external usenet poster
 
Posts: 8,651
Default Trouble adding or subtracting from the current month

You may have missed the part of my message below where I said:
"[but remember the usual questions, such as what date do you regard as being
3 months before 31st May?]"
--
David Biddulph

"daddylonglegs" wrote in message
...
Hello David,

That won't give the correct result in all circumstances, e.g. on 30th and
31st May it'll return "March".

Biff's formula above will give an error in January or February....

...and my suggestion above is also flawed, this should fix it....

=TEXT((MOD(MONTH(TODAY())-4,12)+1)*30,"mmmm")


"David Biddulph" wrote:

The reason why you are seeing "January" is that you have fed the TEXT
function the number 7 as an input, but it wants a date as an input.
Excel
dates count from January 1900. Number 7 repressents 7th January 1900.

If you want to feed TEXT with a date 3 months ago, try
=TEXT(DATE(YEAR(TODAY()),MONTH(TODAY())-3,DAY(TODAY())),"mmmm")
[but remember the usual questions, such as what date do you regard as
being
3 months before 31st May?]
Note that I've used TODAY(), as that gives a date. NOW(), which you
used,
gives date and time, but the time is unnecessary in this context.
--
David Biddulph

"Dave L" wrote in message
...
I'm trying to write a formula that will take the current month and
subtract 3
from it and then display the full month name. This formula returns a 7
as
expected:
=MONTH(NOW())-3

But when I add the Text function to it so it returns "July" it always
displays "January" no matter what number i subtract:
=TEXT(MONTH(NOW())-3,"mmmm")

I can't just format the cell because this needs to be embedded into
another
formula. How to i make it return the correct name of the month?