Welcome to the { mindfrost82.com } forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > Excel

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-07-2008, 07:18 PM
MitchellWMA
 
Posts: n/a
Change date format for existing sheet? (XL2K+XL2003)

Don't know if this will be the right group for this.

I have some spreadsheets that I must chart but the date formats are
not the best.

The sheet has the months like this:
April 1 to 30
May 1 to 31
June 1 to 30
July 1 to 31
August 1 to 31
September1 to 30
October 1 to 31
November1 to 30
December 1 to 31
January 1 to 31
February 1 to 28
March 1 to 31

When I will need the smallest yet most complete info so that if I
could convert the above quickly to format below, that would be best:
Apr.01-30.2007
May.01-31.2007
Jun.01-30.2007
Jul.01-31.2007
Aug.01-31.2007
Sep.01-30.2007
Oct.01-31.2007
Nov.01-30.2007
Dec.01-31.2007
Jan.01-31.2008
Feb.01-28.2008
Mar.01-31.2008

I haven't a clue on how to do this other than manually, which is not
desirable as too many to change.

Thanks for any help. :oD
Reply With Quote
  #2 (permalink)  
Old 07-07-2008, 08:27 PM
Beege
 
Posts: n/a
Re: Change date format for existing sheet? (XL2K+XL2003)

Mitchell,

I don't see why you need all the extra information (e.g., 1-30, 1-28) It
seems the intent is to include the whole month, like:

April 2007
May 2007
June 2007

Format the cells to MMMM yyyy
Fill in one, drag down as needed...

No help?

Beege


MitchellWMA wrote:
> Don't know if this will be the right group for this.
>
> I have some spreadsheets that I must chart but the date formats are
> not the best.
>
> The sheet has the months like this:
> April 1 to 30
> May 1 to 31
> June 1 to 30
> July 1 to 31
> August 1 to 31
> September1 to 30
> October 1 to 31
> November1 to 30
> December 1 to 31
> January 1 to 31
> February 1 to 28
> March 1 to 31
>
> When I will need the smallest yet most complete info so that if I
> could convert the above quickly to format below, that would be best:
> Apr.01-30.2007
> May.01-31.2007
> Jun.01-30.2007
> Jul.01-31.2007
> Aug.01-31.2007
> Sep.01-30.2007
> Oct.01-31.2007
> Nov.01-30.2007
> Dec.01-31.2007
> Jan.01-31.2008
> Feb.01-28.2008
> Mar.01-31.2008
>
> I haven't a clue on how to do this other than manually, which is not
> desirable as too many to change.
>
> Thanks for any help. :oD

Reply With Quote
  #3 (permalink)  
Old 07-07-2008, 08:35 PM
Rick Rothstein \(MVP - VB\)
 
Posts: n/a
Re: Change date format for existing sheet? (XL2K+XL2003)

This macro should do what you want (see note at after the code). Right-click
the tab for the worksheet with your dates on it and click "View Code" from
the popup menu that appears. When you do this, you will be taken into the
VBA editor and the code window for that worksheet will be automatically
displayed. Copy/Paste the following code into that code window...

Sub ConvertDateFormats()
Const YearValue As Long = 2007
Const RangeOfDates As String = "A1:A15"
Dim C As Range
Dim Parts() As String
For Each C In Range(RangeOfDates)
If Len(C.Value) > 0 Then
Parts = Split(C.Value, " to ")
Parts(0) = Format(Parts(0) & ", " & YearValue, "mmm.dd")
C.Value = Parts(0) & "-" & Parts(1) & "." & YearValue
End If
Next
End Sub

Note: Change the values assigned in the Const statements at the beginning of
the code to the year for your dates and the range of cells containing your
dates. Now, back on your worksheet, press Alt+F8, select ConvertDateFormats
from the lists and click the Run button. Your dates should all change to the
new values you asked for (this is a permanent change, not simply a cell
format).

Rick


"MitchellWMA" <mitchellwma1@yahoo.com> wrote in message
news:de629d4a-e66b-4659-bbb6-c9513fe812f7@z72g2000hsb.googlegroups.com...
> Don't know if this will be the right group for this.
>
> I have some spreadsheets that I must chart but the date formats are
> not the best.
>
> The sheet has the months like this:
> April 1 to 30
> May 1 to 31
> June 1 to 30
> July 1 to 31
> August 1 to 31
> September1 to 30
> October 1 to 31
> November1 to 30
> December 1 to 31
> January 1 to 31
> February 1 to 28
> March 1 to 31
>
> When I will need the smallest yet most complete info so that if I
> could convert the above quickly to format below, that would be best:
> Apr.01-30.2007
> May.01-31.2007
> Jun.01-30.2007
> Jul.01-31.2007
> Aug.01-31.2007
> Sep.01-30.2007
> Oct.01-31.2007
> Nov.01-30.2007
> Dec.01-31.2007
> Jan.01-31.2008
> Feb.01-28.2008
> Mar.01-31.2008
>
> I haven't a clue on how to do this other than manually, which is not
> desirable as too many to change.
>
> Thanks for any help. :oD


Reply With Quote
  #4 (permalink)  
Old 07-07-2008, 08:44 PM
Pete_UK
 
Posts: n/a
Re: Change date format for existing sheet? (XL2K+XL2003)

With your dates in column A starting at A1, put this formula in B1:

=TEXT(DATEVALUE(LEFT(A1,SEARCH("
to",A1)-1)),"mmm.dd-")&RIGHT(A1,2)&".200"&IF(ISNUMBER(SEARCH(LEFT(A1,3 ),"JanFebMar")),"8","7")

and copy down. Note the space before the 'to' inside the first set of
quotes.

Hope this helps.

Pete

"MitchellWMA" <mitchellwma1@yahoo.com> wrote in message
news:de629d4a-e66b-4659-bbb6-c9513fe812f7@z72g2000hsb.googlegroups.com...
> Don't know if this will be the right group for this.
>
> I have some spreadsheets that I must chart but the date formats are
> not the best.
>
> The sheet has the months like this:
> April 1 to 30
> May 1 to 31
> June 1 to 30
> July 1 to 31
> August 1 to 31
> September1 to 30
> October 1 to 31
> November1 to 30
> December 1 to 31
> January 1 to 31
> February 1 to 28
> March 1 to 31
>
> When I will need the smallest yet most complete info so that if I
> could convert the above quickly to format below, that would be best:
> Apr.01-30.2007
> May.01-31.2007
> Jun.01-30.2007
> Jul.01-31.2007
> Aug.01-31.2007
> Sep.01-30.2007
> Oct.01-31.2007
> Nov.01-30.2007
> Dec.01-31.2007
> Jan.01-31.2008
> Feb.01-28.2008
> Mar.01-31.2008
>
> I haven't a clue on how to do this other than manually, which is not
> desirable as too many to change.
>
> Thanks for any help. :oD



Reply With Quote
  #5 (permalink)  
Old 07-11-2008, 07:09 PM
MitchellWMA
 
Posts: n/a
Re: Change date format for existing sheet? (XL2K+XL2003)

Pete and Rick, thanks, thanks, thanks! I'll give both approaches a
try. I'm not the creator of the sheet and that's what they have and
that's what I must work with. As this workbook shows info that they
present to the higher ups, obviously must be what the brass wants.
But if I can manipulate the data more easily for charting purposes
then that will make this ideal. I don't know which one will work more
easily, though; I'll test them both out to see what will handle this
best. But great to learn 2 neat ways to do this.

Thanks. Will report back.

Cheers! :oD
Reply With Quote
  #6 (permalink)  
Old 07-11-2008, 08:19 PM
Rick Rothstein \(MVP - VB\)
 
Posts: n/a
Re: Change date format for existing sheet? (XL2K+XL2003)

I just noticed that I did not account for the year switch-over. I am making
the assumption that the list always runs from April of last year to March of
the current year (that way, the year will always update correctly from
year-to-year). Here is the corrected code...

Sub ConvertDateFormats()
Dim YearValue As Long
Const RangeOfDates As String = "A1:A15"
Dim C As Range
Dim Parts() As String
YearValue = Year(Now) - 1
For Each C In Range(RangeOfDates)
If Len(C.Value) > 0 Then
Parts = Split(C.Value, " to ")
Parts(0) = Format(Parts(0) & ", " & YearValue, "mmm.dd")
C.Value = Parts(0) & "-" & Parts(1) & "." & YearValue - _
(InStr("JanFebMar", Left(Parts(0), 3)) > 0)
End If
Next
End Sub

Rick


"Rick Rothstein (MVP - VB)" <rick.newsNO.SPAM@NO.SPAMverizon.net> wrote in
message news:eSIjbiG4IHA.1196@TK2MSFTNGP05.phx.gbl...
> This macro should do what you want (see note at after the code).
> Right-click the tab for the worksheet with your dates on it and click
> "View Code" from the popup menu that appears. When you do this, you will
> be taken into the VBA editor and the code window for that worksheet will
> be automatically displayed. Copy/Paste the following code into that code
> window...
>
> Sub ConvertDateFormats()
> Const YearValue As Long = 2007
> Const RangeOfDates As String = "A1:A15"
> Dim C As Range
> Dim Parts() As String
> For Each C In Range(RangeOfDates)
> If Len(C.Value) > 0 Then
> Parts = Split(C.Value, " to ")
> Parts(0) = Format(Parts(0) & ", " & YearValue, "mmm.dd")
> C.Value = Parts(0) & "-" & Parts(1) & "." & YearValue
> End If
> Next
> End Sub
>
> Note: Change the values assigned in the Const statements at the beginning
> of the code to the year for your dates and the range of cells containing
> your dates. Now, back on your worksheet, press Alt+F8, select
> ConvertDateFormats from the lists and click the Run button. Your dates
> should all change to the new values you asked for (this is a permanent
> change, not simply a cell format).
>
> Rick
>
>
> "MitchellWMA" <mitchellwma1@yahoo.com> wrote in message
> news:de629d4a-e66b-4659-bbb6-c9513fe812f7@z72g2000hsb.googlegroups.com...
>> Don't know if this will be the right group for this.
>>
>> I have some spreadsheets that I must chart but the date formats are
>> not the best.
>>
>> The sheet has the months like this:
>> April 1 to 30
>> May 1 to 31
>> June 1 to 30
>> July 1 to 31
>> August 1 to 31
>> September1 to 30
>> October 1 to 31
>> November1 to 30
>> December 1 to 31
>> January 1 to 31
>> February 1 to 28
>> March 1 to 31
>>
>> When I will need the smallest yet most complete info so that if I
>> could convert the above quickly to format below, that would be best:
>> Apr.01-30.2007
>> May.01-31.2007
>> Jun.01-30.2007
>> Jul.01-31.2007
>> Aug.01-31.2007
>> Sep.01-30.2007
>> Oct.01-31.2007
>> Nov.01-30.2007
>> Dec.01-31.2007
>> Jan.01-31.2008
>> Feb.01-28.2008
>> Mar.01-31.2008
>>
>> I haven't a clue on how to do this other than manually, which is not
>> desirable as too many to change.
>>
>> Thanks for any help. :oD

>


Reply With Quote
  #7 (permalink)  
Old 07-11-2008, 08:20 PM
Rick Rothstein \(MVP - VB\)
 
Posts: n/a
Re: Change date format for existing sheet? (XL2K+XL2003)

See the corrected code I just posted under my original code posting.

Rick


"MitchellWMA" <mitchellwma1@yahoo.com> wrote in message
news:9c258d9d-447c-4666-b808-2f48ebc673ef@27g2000hsf.googlegroups.com...
> Pete and Rick, thanks, thanks, thanks! I'll give both approaches a
> try. I'm not the creator of the sheet and that's what they have and
> that's what I must work with. As this workbook shows info that they
> present to the higher ups, obviously must be what the brass wants.
> But if I can manipulate the data more easily for charting purposes
> then that will make this ideal. I don't know which one will work more
> easily, though; I'll test them both out to see what will handle this
> best. But great to learn 2 neat ways to do this.
>
> Thanks. Will report back.
>
> Cheers! :oD


Reply With Quote
  #8 (permalink)  
Old 07-11-2008, 08:37 PM
Rick Rothstein \(MVP - VB\)
 
Posts: n/a
Re: Change date format for existing sheet? (XL2K+XL2003)

On the off-chance that making the change permanent could be a problem for
you, I have modified the macro to be a toggle; each time you execute the
macro, it will change the format of the values back and forth between the
"April 1 to 30" format and the "Apr.01-30.2007" format. Try it out, I think
you will like it...

Sub ConvertDateFormats()
Dim YearValue As Long
Const RangeOfDates As String = "A1:A15"
Dim C As Range
Dim Parts() As String
YearValue = Year(Now) - 1
For Each C In Range(RangeOfDates)
If Len(C.Value) > 0 Then
If InStr(C.Value, ".") = 0 Then
Parts = Split(C.Value, " to ")
Parts(0) = Format(Parts(0) & ", " & YearValue, "mmm.dd")
C.Value = Parts(0) & "-" & Parts(1) & "." & YearValue - _
(InStr("JanFebMar", Left(Parts(0), 3)) > 0)
Else
Parts = Split(Left(C.Value, 9), "-")
Parts(0) = Format(CDate(Replace(Parts(0), ".", " ") & ", 2000"),
"mmmm d \t\o")
C.Value = Join(Parts, " ")
End If
End If
Next
End Sub

Rick


"Rick Rothstein (MVP - VB)" <rick.newsNO.SPAM@NO.SPAMverizon.net> wrote in
message news:uyhkYs44IHA.3828@TK2MSFTNGP02.phx.gbl...
>I just noticed that I did not account for the year switch-over. I am making
>the assumption that the list always runs from April of last year to March
>of the current year (that way, the year will always update correctly from
>year-to-year). Here is the corrected code...
>
> Sub ConvertDateFormats()
> Dim YearValue As Long
> Const RangeOfDates As String = "A1:A15"
> Dim C As Range
> Dim Parts() As String
> YearValue = Year(Now) - 1
> For Each C In Range(RangeOfDates)
> If Len(C.Value) > 0 Then
> Parts = Split(C.Value, " to ")
> Parts(0) = Format(Parts(0) & ", " & YearValue, "mmm.dd")
> C.Value = Parts(0) & "-" & Parts(1) & "." & YearValue - _
> (InStr("JanFebMar", Left(Parts(0), 3)) > 0)
> End If
> Next
> End Sub
>
> Rick
>
>
> "Rick Rothstein (MVP - VB)" <rick.newsNO.SPAM@NO.SPAMverizon.net> wrote in
> message news:eSIjbiG4IHA.1196@TK2MSFTNGP05.phx.gbl...
>> This macro should do what you want (see note at after the code).
>> Right-click the tab for the worksheet with your dates on it and click
>> "View Code" from the popup menu that appears. When you do this, you will
>> be taken into the VBA editor and the code window for that worksheet will
>> be automatically displayed. Copy/Paste the following code into that code
>> window...
>>
>> Sub ConvertDateFormats()
>> Const YearValue As Long = 2007
>> Const RangeOfDates As String = "A1:A15"
>> Dim C As Range
>> Dim Parts() As String
>> For Each C In Range(RangeOfDates)
>> If Len(C.Value) > 0 Then
>> Parts = Split(C.Value, " to ")
>> Parts(0) = Format(Parts(0) & ", " & YearValue, "mmm.dd")
>> C.Value = Parts(0) & "-" & Parts(1) & "." & YearValue
>> End If
>> Next
>> End Sub
>>
>> Note: Change the values assigned in the Const statements at the beginning
>> of the code to the year for your dates and the range of cells containing
>> your dates. Now, back on your worksheet, press Alt+F8, select
>> ConvertDateFormats from the lists and click the Run button. Your dates
>> should all change to the new values you asked for (this is a permanent
>> change, not simply a cell format).
>>
>> Rick
>>
>>
>> "MitchellWMA" <mitchellwma1@yahoo.com> wrote in message
>> news:de629d4a-e66b-4659-bbb6-c9513fe812f7@z72g2000hsb.googlegroups.com...
>>> Don't know if this will be the right group for this.
>>>
>>> I have some spreadsheets that I must chart but the date formats are
>>> not the best.
>>>
>>> The sheet has the months like this:
>>> April 1 to 30
>>> May 1 to 31
>>> June 1 to 30
>>> July 1 to 31
>>> August 1 to 31
>>> September1 to 30
>>> October 1 to 31
>>> November1 to 30
>>> December 1 to 31
>>> January 1 to 31
>>> February 1 to 28
>>> March 1 to 31
>>>
>>> When I will need the smallest yet most complete info so that if I
>>> could convert the above quickly to format below, that would be best:
>>> Apr.01-30.2007
>>> May.01-31.2007
>>> Jun.01-30.2007
>>> Jul.01-31.2007
>>> Aug.01-31.2007
>>> Sep.01-30.2007
>>> Oct.01-31.2007
>>> Nov.01-30.2007
>>> Dec.01-31.2007
>>> Jan.01-31.2008
>>> Feb.01-28.2008
>>> Mar.01-31.2008
>>>
>>> I haven't a clue on how to do this other than manually, which is not
>>> desirable as too many to change.
>>>
>>> Thanks for any help. :oD

>>

>


Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > Excel


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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



All times are GMT. The time now is 03:39 AM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0


Sponsors:
Apple Store | Flights | Mortgage Loans | Credit Counseling | Blog5 Game Cheats



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114