ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Convert Date to number? (https://www.excelbanter.com/excel-worksheet-functions/87510-convert-date-number.html)

JethroUK©

Convert Date to number?
 
How would i convert a date to number as a string

e.g. 10/05/2005 "20050510"

note the month is 2 digit - 05

i cant see Format(A1,"yyyy,mm,dd") & i tried = year(a1) & month(a1) &
day(a1)

but it returns month as single "2005510"



JethroUK©

Convert Date to number?
 
p.s. i also tried cell formatting as yyyymmdd, then = "Hello" & A1 - but it
doesn't import the format to a string


"JethroUK©" wrote in message
...
How would i convert a date to number as a string

e.g. 10/05/2005 "20050510"

note the month is 2 digit - 05

i cant see Format(A1,"yyyy,mm,dd") & i tried = year(a1) & month(a1) &
day(a1)

but it returns month as single "2005510"





Miguel Zapico

Convert Date to number?
 
You can try with TEXT, like this:
=TEXT(A1,"yyyymmdd")

Miguel.

"JethroUK©" wrote:

p.s. i also tried cell formatting as yyyymmdd, then = "Hello" & A1 - but it
doesn't import the format to a string


"JethroUK©" wrote in message
...
How would i convert a date to number as a string

e.g. 10/05/2005 "20050510"

note the month is 2 digit - 05

i cant see Format(A1,"yyyy,mm,dd") & i tried = year(a1) & month(a1) &
day(a1)

but it returns month as single "2005510"






Sandy Mann

Convert Date to number?
 
There may be better ways but:

=TEXT(YEAR(E10),"####")&TEXT(MONTH(E10),"0#")&TEXT (DAY(E10),"0#")

returns what you are looking for
--
HTH

Sandy
In Perth, the ancient capital of Scotland


with @tiscali.co.uk


"JethroUK©" wrote in message
...
How would i convert a date to number as a string

e.g. 10/05/2005 "20050510"

note the month is 2 digit - 05

i cant see Format(A1,"yyyy,mm,dd") & i tried = year(a1) & month(a1) &
day(a1)

but it returns month as single "2005510"





Sandy Mann

Convert Date to number?
 
"Miguel Zapico" wrote in message
...
You can try with TEXT, like this:
=TEXT(A1,"yyyymmdd")


There I told you there may be better ways! <g
--

Sandy
In Perth, the ancient capital of Scotland


with @tiscali.co.uk




JethroUK©

Convert Date to number?
 
that's fine

so how will i emmbed this in a string e.g.

="Bill" & TEXT(A1,"yyyymmdd") & "Ben"



"Miguel Zapico" wrote in message
...
You can try with TEXT, like this:
=TEXT(A1,"yyyymmdd")

Miguel.

"JethroUK©" wrote:

p.s. i also tried cell formatting as yyyymmdd, then = "Hello" & A1 - but

it
doesn't import the format to a string


"JethroUK©" wrote in message
...
How would i convert a date to number as a string

e.g. 10/05/2005 "20050510"

note the month is 2 digit - 05

i cant see Format(A1,"yyyy,mm,dd") & i tried = year(a1) & month(a1) &
day(a1)

but it returns month as single "2005510"








JethroUK©

Convert Date to number?
 
works fine - thanks


"JethroUK©" wrote in message
...
that's fine

so how will i emmbed this in a string e.g.

="Bill" & TEXT(A1,"yyyymmdd") & "Ben"



"Miguel Zapico" wrote in message
...
You can try with TEXT, like this:
=TEXT(A1,"yyyymmdd")

Miguel.

"JethroUK©" wrote:

p.s. i also tried cell formatting as yyyymmdd, then = "Hello" & A1 -

but
it
doesn't import the format to a string


"JethroUK©" wrote in message
...
How would i convert a date to number as a string

e.g. 10/05/2005 "20050510"

note the month is 2 digit - 05

i cant see Format(A1,"yyyy,mm,dd") & i tried = year(a1) & month(a1)

&
day(a1)

but it returns month as single "2005510"











All times are GMT +1. The time now is 06:36 AM.

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