Question

I have an excel document with about 500 rows. I need to format all the cells in , let's say, B column from date to text.

This is how it looks like now:

2012-06-15
2012-06-01
2012-06-14

What it looks like when formated to text:

41075
41061
41074

It has come to my understanding that this is a timestamp representing days since 1st januari 1900, right? Anyhow, this is not what I want. I want the value of the field to be exactly what it is but with the column type of text. I've found various solutions for this using functions like this: =TEXT(B1, "yyyy-mm-dd") but that is not reformating the cell, it is extracting a value from one cell, reformat it and represent is as text in another.

The rule I'm after: I want all cells in B column to have the type text without changing the value

Thanks!

Was it helpful?

Solution

If you have a situation where columns A to D are dates of 500 rows you then:

  1. Use the =TEXT(A1, "yyyy-mm-dd") function you describe in cell E1.

  2. Copy this formula 4 columns wide, and 500 rows down.

  3. Then copy and paste values to the preceding cells.

Copy Example:

Copy

Output:

Output

OTHER TIPS

You're right, Excel stores dates internally as number of days since January 1st, 1900 (apart from a minor leap year bug).

Thus, I'm afraid you cannot have both:

  • Either you keep the value e.g. (41075) and simply format it as a date, so it'll be displayed as 2012-06-15 -
  • Or you convert it to text format - but then you either
    • Lose the underlying value - if you convert it to the format you wish with a text function as you mentioned
    • Keep the value (41075), but cannot see the date

If you are typing in the values you can by adding a ' before the values to keep it as text.

e.g.

Example Output

But depending on the method the third party service uses to import these values this may not work and I bet you will not get around it unless you export it to a text editor and import it again.

Also try to play with diferent types of text for your third party service, e.g. "2012-06-15" as some see the quotes and remove them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top