Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
 
Posts: n/a
Default How to format date as text without changing appearance?

I have a column of 10900 cells with dates of the form
13-May-05. Excel automatically interpreted them as
dates when I imported the data from a text file. Now
I want them to be interpreted as text. The problem is:
when I change the format to "text", the cell content
changes to a number. For example, 13-May-05 becomes
38485.

Hindsight being 20-20, I should have entered the dates
in the form '13-May-50. But it is too late for that
now, I think.

How can I change the cell format to the text 13-May-05
without manually changing all 10900 cells?

  #2   Report Post  
 
Posts: n/a
Default

Hi

I reckon you'll either need someone on the NG to write you a macro to do
this job in situ, or you can use a helper column, alongside the existing
column and then replace the column with the new one.
In the helper column use:
=TEXT(A2,"dd-mmm-yy")
and fill this down. Once you are happy with the result, copy the range and
Edit|Paste Special|Values to replace your formulas with the actual values.
Then you can replace the current column with the new one.
Make sure you take a copy of your data before you start!

--
Andy.


wrote in message
oups.com...
I have a column of 10900 cells with dates of the form
13-May-05. Excel automatically interpreted them as
dates when I imported the data from a text file. Now
I want them to be interpreted as text. The problem is:
when I change the format to "text", the cell content
changes to a number. For example, 13-May-05 becomes
38485.

Hindsight being 20-20, I should have entered the dates
in the form '13-May-50. But it is too late for that
now, I think.

How can I change the cell format to the text 13-May-05
without manually changing all 10900 cells?



  #3   Report Post  
 
Posts: n/a
Default

<Andy B wrote:
In the helper column use: =TEXT(A2,"dd-mmm-yy")
[....] copy the range and Edit|Paste Special|Values
to replace your formulas with the actual values.


Yes. Great! That does solve the problem I asked about.
Thanks.

But now I have a Catch-22. I need the dates to be treated
as text because I want to have gaps in the sequence --
adjacent cells that are not adjacent dates.

But when I select that column (after applying your
suggestion) as the X-axis for a chart, the X-axis labels
appear as ordinal numbers 1, 2, etc.

I wanted the cell context (dates) to appear as X-axis
labels. They appeared that way when the cell value was
interpreted as in "date" format. (Klunk!)

Can I have cake and eat it, too?

  #4   Report Post  
Peter Rooney
 
Posts: n/a
Default

Hi, Joe

Try pasting this into a module sheet:

Sub AddApostropheToRange()
Dim CellToModify As Object
For Each CellToModify In Selection
CellToModify.Formula = "'" & CellToModify.Formula
Next CellToModify
End Sub

Then, select all the cells you want to modify, hit Alt-F8 and run the macro.

Hope this helps

Pete



" wrote:

I have a column of 10900 cells with dates of the form
13-May-05. Excel automatically interpreted them as
dates when I imported the data from a text file. Now
I want them to be interpreted as text. The problem is:
when I change the format to "text", the cell content
changes to a number. For example, 13-May-05 becomes
38485.

Hindsight being 20-20, I should have entered the dates
in the form '13-May-50. But it is too late for that
now, I think.

How can I change the cell format to the text 13-May-05
without manually changing all 10900 cells?


  #5   Report Post  
 
Posts: n/a
Default

Hi

If you just want the date, you could make the extra column using
=TEXT(A2,"dd")
leave the column there and use that for your graph.

--
Andy.


wrote in message
oups.com...
<Andy B wrote:
In the helper column use: =TEXT(A2,"dd-mmm-yy")
[....] copy the range and Edit|Paste Special|Values
to replace your formulas with the actual values.


Yes. Great! That does solve the problem I asked about.
Thanks.

But now I have a Catch-22. I need the dates to be treated
as text because I want to have gaps in the sequence --
adjacent cells that are not adjacent dates.

But when I select that column (after applying your
suggestion) as the X-axis for a chart, the X-axis labels
appear as ordinal numbers 1, 2, etc.

I wanted the cell context (dates) to appear as X-axis
labels. They appeared that way when the cell value was
interpreted as in "date" format. (Klunk!)

Can I have cake and eat it, too?



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
Convert numbers from text format to number format merlin68 Excel Discussion (Misc queries) 7 June 20th 07 07:03 PM
Conditonal Format with a date format Kevin Excel Discussion (Misc queries) 2 April 27th 05 10:20 PM
Format a cell with numbers and user defined text Rod R. Excel Discussion (Misc queries) 0 March 30th 05 04:31 PM
Opening a csv file with US date format on a Australian PC Troy Lea Excel Discussion (Misc queries) 2 March 16th 05 10:05 PM
how to format numbers stored as text or vice versa to use vlookup teneagle Excel Worksheet Functions 1 February 3rd 05 10:41 PM


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

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"