Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default yyyymmdd date format

hello,
I have a data base with no date format, just a series of numbers like
20041128 for November 28th year 2004. How can I give this information
a date format?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default yyyymmdd date format

Assume that value is in A1
in B1

=DATEVALUE(MID(A1,5,2) & "/" & RIGHT(A1,2) & "/" & LEFT(A1,4))

then format the cell with the formula with a date format.

--
Regards,
Tom Ogilvy


"German Velasquez" wrote in message
om...
hello,
I have a data base with no date format, just a series of numbers like
20041128 for November 28th year 2004. How can I give this information
a date format?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default yyyymmdd date format

If you convert it to a real date, you can format it (via format|cells|number
tab) any way you want.

One way to convert a column of those type values is to select the column,
then Data|text to columns
Choose Fixed width
(remove any line that excel guessed--and don't add any of your own)
Choose a format of ymd
and plop it right back where you picked it up.

German Velasquez wrote:

hello,
I have a data base with no date format, just a series of numbers like
20041128 for November 28th year 2004. How can I give this information
a date format?


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default yyyymmdd date format



"German Velasquez" wrote:

hello,
I have a data base with no date format, just a series of numbers like
20041128 for November 28th year 2004. How can I give this information
a date format?
There may be a cleaner hack than this. But it will work.


=DATE(LEFT(cell_reference,4),MID(cell_reference,5, 2),RIGHT(cell_reference,2))


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default yyyymmdd date format

Hi Tom, and German,
Why wouldn't you use
=DATE(LEFT(A1,4), MID(A1,5,2), Right(A1,2))
which should be easier on Excel and would be valid
no matter what their Regional settings are for date.

Since my regional settings are usually set to yyyy-mm-dd
your formula would fail for me.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Tom Ogilvy" wrote in message ...
Assume that value is in A1
in B1

=DATEVALUE(MID(A1,5,2) & "/" & RIGHT(A1,2) & "/" & LEFT(A1,4))

then format the cell with the formula with a date format.

--
Regards,
Tom Ogilvy


"German Velasquez" wrote in message
om...
hello,
I have a data base with no date format, just a series of numbers like
20041128 for November 28th year 2004. How can I give this information
a date format?







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default yyyymmdd date format

Hi
and another option
=--TEXT(--A1,"0000-00-00")
and format as date

--
Regards
Frank Kabel
Frankfurt, Germany

"German Velasquez" schrieb im Newsbeitrag
om...
hello,
I have a data base with no date format, just a series of numbers like
20041128 for November 28th year 2004. How can I give this information
a date format?


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default yyyymmdd date format

Frank,
Out of interest, what is the meaning of "--" in Excel formulae ?

NickHK

"Frank Kabel" wrote in message
...
Hi
and another option
=--TEXT(--A1,"0000-00-00")
and format as date

--
Regards
Frank Kabel
Frankfurt, Germany

"German Velasquez" schrieb im Newsbeitrag
om...
hello,
I have a data base with no date format, just a series of numbers like
20041128 for November 28th year 2004. How can I give this information
a date format?




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default yyyymmdd date format

-- converts numbers returned as text or logical values (TRUE/FALSE) into
numerical values, similar to the function VALUE(), but I think the latter
can't convert the logical values.

KL

"NickHK" wrote in message
...
Frank,
Out of interest, what is the meaning of "--" in Excel formulae ?

NickHK

"Frank Kabel" wrote in message
...
Hi
and another option
=--TEXT(--A1,"0000-00-00")
and format as date

--
Regards
Frank Kabel
Frankfurt, Germany

"German Velasquez" schrieb im Newsbeitrag
om...
hello,
I have a data base with no date format, just a series of numbers like
20041128 for November 28th year 2004. How can I give this information
a date format?






  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default yyyymmdd date format

It's a thing that Frank does so that people ask what it is :)

But seriously...
It's a double unary operator - it has special uses.

There's a great thread about it - he
http://groups.google.com/groups?hl=e...ing.google.com

And here's some good reading:
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"NickHK" wrote in message
...
Frank,
Out of interest, what is the meaning of "--" in Excel formulae ?

NickHK

"Frank Kabel" wrote in message
...
Hi
and another option
=--TEXT(--A1,"0000-00-00")
and format as date

--
Regards
Frank Kabel
Frankfurt, Germany

"German Velasquez" schrieb im Newsbeitrag
om...
hello,
I have a data base with no date format, just a series of numbers like
20041128 for November 28th year 2004. How can I give this information
a date format?






  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default yyyymmdd date format

Hi Rob
It's a thing that Frank does so that people ask what it is :)

lol
Good guess from your side but why tell my small secret... ;-)

Regards
Frank



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default yyyymmdd date format

Rob,
The Excel v. VBA handling of booleans seems a bit screwy. Assuming A1=TRUE:

?range("A1").Value=true
True
?-range("A1").Value=true
False
?--range("A1").Value=true
True
?10*range("A1").Value
-10
?10*--range("A1").Value
-10

I can't see the logic for all the above to be valid.

NickHK

"Rob van Gelder" wrote in message
...
It's a thing that Frank does so that people ask what it is :)

But seriously...
It's a double unary operator - it has special uses.

There's a great thread about it - he

http://groups.google.com/groups?hl=e...10528.5bb58 1
37%40posting.google.com

And here's some good reading:
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"NickHK" wrote in message
...
Frank,
Out of interest, what is the meaning of "--" in Excel formulae ?

NickHK

"Frank Kabel" wrote in message
...
Hi
and another option
=--TEXT(--A1,"0000-00-00")
and format as date

--
Regards
Frank Kabel
Frankfurt, Germany

"German Velasquez" schrieb im Newsbeitrag
om...
hello,
I have a data base with no date format, just a series of numbers like
20041128 for November 28th year 2004. How can I give this information
a date format?







  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default yyyymmdd date format

As in many other languages, in VBA, when coercing numbers to a boolean
value, zero is evaluated as False, any non-zero value will be evaluated
as True.

A True value in VBA will be coerced to -1 in a math operation. In XL,
the coercion is to +1.

In article ,
"NickHK" wrote:

Rob,
The Excel v. VBA handling of booleans seems a bit screwy. Assuming A1=TRUE:

?range("A1").Value=true
True
?-range("A1").Value=true
False
?--range("A1").Value=true
True
?10*range("A1").Value
-10
?10*--range("A1").Value
-10

I can't see the logic for all the above to be valid.

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
how do I change the date format from yyyymmdd to mm/dd/yyyy Charlene Excel Worksheet Functions 5 May 6th 23 07:46 PM
Change date from yyyymmdd to valid date format denilynn Excel Discussion (Misc queries) 4 September 2nd 09 07:19 PM
How do I change date yyyymmdd to a Excel-supported date format? dan Excel Worksheet Functions 4 July 6th 08 11:05 PM
I need a yyyymmdd date format with no dashes EXCEL HELP PLEASE Excel Discussion (Misc queries) 2 December 21st 06 08:19 PM
Is there an Excel date format as follows: yyyymmdd? N Excel Discussion (Misc queries) 3 June 22nd 06 09:44 PM


All times are GMT +1. The time now is 01:09 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"