Date Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to get excel to return the previous month using the following formula and the result is always "Jan" (without the quotation marks). What am I doing wrong

=TEXT(MONTH(TODAY())-1),"mmm"

Is what I'm trying to do even possible? Thanks in advance..

Don Rountree
 
Don

If you want to keep the value as a date you could use:

=TODAY()-DAY(TODAY())

and format the cell as mmm

Andy.

Don Rountree said:
I'm trying to get excel to return the previous month using the following
formula and the result is always "Jan" (without the quotation marks). What
am I doing wrong?
 
Hi Don!

Two other ways:

=DATE(YEAR(TODAY()),MONTH(TODAY()),0)
Format mmm

Excel regards the 0th of a month as being the last day of the
preceding month.

Or if you just want the month as text:

=TEXT((MONTH(TODAY())-1)*29,"mmm")

Relies on the fact that Excel uses date serial numbers where all days
are number of days from 31-Dec-1899. Any month number * 29 produces a
date in that month in 1900. It doesn't matter what that 1900 date is
because we are want the text form.


--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
Don Rountree said:
I'm trying to get excel to return the previous month using the
following formula and the result is always "Jan" (without the
quotation marks). What am I doing wrong?
 
Hi Don,

Make sure that Analysis ToolPak is active, then

= EOMONTH(TODAY(),-1)

gives the last day of the previous Month.

=TEXT(EOMONTH(TODAY()-1),"mmm")

gives Jan,..........if used today.


David
 
Back
Top