Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
DP NY10601
 
Posts: n/a
Default Date Format when incoming date can be 0

I have a date fiels yyyymmdd which can have a value of 0 or a valid date in
recent past.
Excel displays the 0 date as 01/01/1900 and the non zero dates as expected.

Cant figure this out , any help would be appreciated.
  #2   Report Post  
bj
 
Posts: n/a
Default

Excel uses a sequencial number from either 1/1/1900, or 1/1/1904 (depending
on your options) as the date value
for Example 6/3/2005 is 38506 using the 1/1/1900
if the cell is formatted as a date it is responding with the date it thinks
you mean.
If you want the cell to display a zero
=if(Date=0,"0",date)

"DP NY10601" wrote:

I have a date fiels yyyymmdd which can have a value of 0 or a valid date in
recent past.
Excel displays the 0 date as 01/01/1900 and the non zero dates as expected.

Cant figure this out , any help would be appreciated.

  #3   Report Post  
Peo Sjoblom
 
Posts: n/a
Default

yyyymmdd is not a valid excel date format, excel needs date deimiters or else
it will treat it as a number.. Excel year zero started on Jan 0 1900 so if you
put 0 in a cell it will return 01/00/1900, 1 will be 01/01/1900

If you get a date in yyyymmdd format, select it, do datatext to columns and
click next twice, select Date under column data format and from dropdown
select YMD
and click finish and it will be converted to a real excel date

Regards,

Peo Sjoblom


"DP NY10601" wrote:

I have a date fiels yyyymmdd which can have a value of 0 or a valid date in
recent past.
Excel displays the 0 date as 01/01/1900 and the non zero dates as expected.

Cant figure this out , any help would be appreciated.

  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

Just to add to Peo's instructions.

Before you do the Data|Text to columns and before you format that column as a
date,

Edit|Replace
what: 0
with: (leave blank)
replace all

It's less typing than:
Edit|Replace
what: 01/00/1900
with: (leave blank)
replace all


Peo Sjoblom wrote:

yyyymmdd is not a valid excel date format, excel needs date deimiters or else
it will treat it as a number.. Excel year zero started on Jan 0 1900 so if you
put 0 in a cell it will return 01/00/1900, 1 will be 01/01/1900

If you get a date in yyyymmdd format, select it, do datatext to columns and
click next twice, select Date under column data format and from dropdown
select YMD
and click finish and it will be converted to a real excel date

Regards,

Peo Sjoblom

"DP NY10601" wrote:

I have a date fiels yyyymmdd which can have a value of 0 or a valid date in
recent past.
Excel displays the 0 date as 01/01/1900 and the non zero dates as expected.

Cant figure this out , any help would be appreciated.


--

Dave Peterson
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
format the "date" button for a header sc11 Excel Discussion (Misc queries) 1 May 12th 05 03:48 AM
Conditonal Format with a date format Kevin Excel Discussion (Misc queries) 2 April 27th 05 10:20 PM
Excel enters date as a text format Kane Excel Discussion (Misc queries) 3 March 22nd 05 09:20 PM
How to format a date to a different format Laura Excel Discussion (Misc queries) 1 March 5th 05 09:59 PM
Date Format Question Josh O. Excel Discussion (Misc queries) 1 February 10th 05 09:45 PM


All times are GMT +1. The time now is 08:34 PM.

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"