LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Extract a YearMonth value from a Date

I want to populate a Month Column (with the format YMM) from the
adjacent Date column,
through a loop which would translate a date like 8/15/2007 to 708.
The Excel formula is Year(DateField)*100+Month(Datefield)-200000
Now , I want to incorporate this logic in my loop code, and for good
measure, add an IsDate test.
I am still a newbie. I tried to get the help of the Macro Recorder,
but I am stuck.
Can you help me with this code ?. Thank you.

Dim RowNdx As Long: Dim LastRow As Long: LastRow =
ActiveSheet.UsedRange.Rows.Count
For RowNdx = LastRow To 2 Step -1
If IsDate(Cells(RowNdx, "Z").Value) Then
Cells(RowNdx, "Y").Value = "=YEAR((Cells(RowNdx,
'Z').Value)*100+MONTH((Cells (RowNdx, 'Z').Value)-200000"
Next RowNdx

Celeste

 
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
Extract Date christmaslog Excel Worksheet Functions 1 February 19th 06 10:28 AM
extract name when a date in another cell gets near cityfc Excel Discussion (Misc queries) 1 November 9th 05 07:40 PM
extract date from the most current date Cali00 Excel Discussion (Misc queries) 1 April 13th 05 02:05 PM
Extract date from cell Eric Excel Worksheet Functions 3 November 4th 04 06:37 PM


All times are GMT +1. The time now is 02:15 AM.

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

About Us

"It's about Microsoft Excel"