Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert time fields to strings in Excel

I have an excel sheet full of times.

They are formatted so that they look like: 1:00:15

However if I change the format on the cells to text, they change to the underlying numeric representation of the time: 0.041840278

How can I convert the cells to be text cells but still have the time in them ?

like image 232
Gareth Simpson Avatar asked Oct 21 '08 03:10

Gareth Simpson


People also ask

How do I convert time to string in Excel?

In the blank cell, type this formula =DATE(LEFT(A1,4),MID(A1,5,2),MID(A1,7,2))+TIME(MID(A1,10,2),RIGHT(A1,2),0), and then press Enter key, if you need, you can apply this formula to a range.


1 Answers

This kind of this is always a pain in Excel, you have to convert the values using a function because once Excel converts the cells to Time they are stored internally as numbers. Here is the best way I know how to do it:

I'll assume that your times are in column A starting at row 1. In cell B1 enter this formula: =TEXT(A1,"hh:mm:ss AM/PM") , drag the formula down column B to the end of your data in column A. Select the values from column B, copy, go to column C and select "Paste Special", then select "Values". Select the cells you just copied into column C and format the cells as "Text".

like image 151
Robert Gamble Avatar answered Sep 23 '22 16:09

Robert Gamble