ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How to convert string to date (https://www.excelbanter.com/excel-worksheet-functions/112491-how-convert-string-date.html)

phil

How to convert string to date
 
Hello,

I have a string in Col H that is like this: 20021002.

I want it to show in Col I as 10/02/02, but I don't want it to be in date
format, just text format. However, if I DID want it date format, can you
also put what that would be as well?

What do you suggest?

TIA,

Phil

Marcelo

How to convert string to date
 
hi Phil

=date(left(a2,4),mid(a2,5,2),right(a2,2))

hth
--
regards from Brazil
Thanks in advance for your feedback.
Marcelo



"Phil" escreveu:

Hello,

I have a string in Col H that is like this: 20021002.

I want it to show in Col I as 10/02/02, but I don't want it to be in date
format, just text format. However, if I DID want it date format, can you
also put what that would be as well?

What do you suggest?

TIA,

Phil


David Billigmeier

How to convert string to date
 
Assume cell A1:

To output as text:
=TEXT(DATE(LEFT(A1,4),MID(A1,5,2),RIGHT(A1,2)),"mm/dd/yyyy")

To output as date:
=DATE(LEFT(A1,4),MID(A1,5,2),RIGHT(A1,2))
Then:
<Format
<Cells
"Custom" tab
enter: mm/dd/yyyy

--
Regards,
Dave


"Phil" wrote:

Hello,

I have a string in Col H that is like this: 20021002.

I want it to show in Col I as 10/02/02, but I don't want it to be in date
format, just text format. However, if I DID want it date format, can you
also put what that would be as well?

What do you suggest?

TIA,

Phil



All times are GMT +1. The time now is 10:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com