Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Extract month from date

I have a cell with the date in the format of November 1, 2008 and I want to
read that cell and put the previous month and current year (unless the month
displayed in the cell is January, in which case I want the new cell to show
December of the previous year) into a text string in another cell. I always
struggle manipulating dates in Excel and as usual, I can't get the correct
formula. Please help.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,572
Default Extract month from date

With original legal XL date in A1, try:

=TEXT(DATE(YEAR(A1),MONTH(A1)-1,1),"mmmm/yyyy")

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"Ken G." wrote in message
...
I have a cell with the date in the format of November 1, 2008 and I want

to
read that cell and put the previous month and current year (unless the

month
displayed in the cell is January, in which case I want the new cell to

show
December of the previous year) into a text string in another cell. I

always
struggle manipulating dates in Excel and as usual, I can't get the correct
formula. Please help.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,344
Default Extract month from date

Hi,

First, for the prior month

=EDATE(A1,-1)

Where the original date is in A1. This gives you the same day of the month,
but in the prior month, regardless of the year. This is an analysis toolpak
function, so if you are using Excel 2003 or earlier choose Tools, Add-ins,
and check the box beside Analysis ToolPak

Second, to use the result in a text string

a. Where the text string is typed into the formula:

="The date is: "&TEXT(EDATE(A1,-1),"MMMM")

The MMMM is just the format codes, from the Format Cells dialog box, that
cause the format to display the month aa a fully spelled name.

b. Where the text string is in another cell:

=B1&" - "&TEXT(EDATE(A1,-1),"m/d/yy")

In this case your date would be displayed as 9/4/08. Again just the format
codes for that display. Notice that caps don't make any difference.

If this helps, please click the Yes button.


--
Thanks,
Shane Devenshire


"Ken G." wrote:

I have a cell with the date in the format of November 1, 2008 and I want to
read that cell and put the previous month and current year (unless the month
displayed in the cell is January, in which case I want the new cell to show
December of the previous year) into a text string in another cell. I always
struggle manipulating dates in Excel and as usual, I can't get the correct
formula. Please help.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
EXTRACT MONTH FROM DATE SSJ New Users to Excel 5 March 7th 08 05:55 PM
How can I extract a month from Excel date? lee Excel Discussion (Misc queries) 6 October 26th 06 02:43 AM
Sort month/date/year data using month and date only SMW820 Excel Discussion (Misc queries) 6 June 22nd 06 05:14 PM
extract the month of a date gireesh Excel Discussion (Misc queries) 11 November 23rd 05 06:10 PM
How to extract month number from month name PM Excel Discussion (Misc queries) 2 January 19th 05 03:07 PM


All times are GMT +1. The time now is 03:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"