PC Review


Reply
Thread Tools Rate Thread

Cell.Text different from Cell.Value when dates are concerned...

 
 
Travis Vandersypen
Guest
Posts: n/a
 
      20th Apr 2010
A company I work for is using Excel to export and import data into other
parts of the program. User A will export data into an Excel file and give it
to User B who then imports that Excel file into their database. Since there
are several Memo/Text fields in the data, the entire export is done doing
automation writing each field's value cell by cell.

Recently, we have discovered that in Excel 2007, although the Cell's Text
field say 1/1/1900, when we query the Value property of that cell it reads as
12/31/1899 12:00:00 am. I could understand the date-time portion of this, but
why does Excel subtract an entire day from the date specified in the Text?
(Please note that the export simply sets the Cell's Text property without any
further consideration to formatting to simulate the way in which a user would
type into the Cell)

I'm thinking this is a definite bug in Excel, but do not know how to report
it to Microsoft. I also find it hard to believe that I would be the first
person to discover this issue, so any help would be greatly appreciated....
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      20th Apr 2010
Hi,

Well it is a bug but an intentional one.

Excel followed on from Lotus 123 and in Lotus there was a genuine bug where
it treated 1900 as a leap year when in fact is wasn't. In order to allow
migration from Lotus to Excel without the need to change dates, Microsoft
continued with the bug and do so to this day. VB displays the correct date
for the value which is 1 day earlier.
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Travis Vandersypen" wrote:

> A company I work for is using Excel to export and import data into other
> parts of the program. User A will export data into an Excel file and give it
> to User B who then imports that Excel file into their database. Since there
> are several Memo/Text fields in the data, the entire export is done doing
> automation writing each field's value cell by cell.
>
> Recently, we have discovered that in Excel 2007, although the Cell's Text
> field say 1/1/1900, when we query the Value property of that cell it reads as
> 12/31/1899 12:00:00 am. I could understand the date-time portion of this, but
> why does Excel subtract an entire day from the date specified in the Text?
> (Please note that the export simply sets the Cell's Text property without any
> further consideration to formatting to simulate the way in which a user would
> type into the Cell)
>
> I'm thinking this is a definite bug in Excel, but do not know how to report
> it to Microsoft. I also find it hard to believe that I would be the first
> person to discover this issue, so any help would be greatly appreciated....

 
Reply With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      20th Apr 2010
It is a known bug in Excel which prevents dates from 1/1/1900 through
2/28/1900 from being calculated properly. You just need to adjust by 1. Lotus
1-2-3 incorrectly treated 1900 as a leap year and for compatibility reasons
this error was maintained so...

--
Jacob (MVP - Excel)


"Travis Vandersypen" wrote:

> A company I work for is using Excel to export and import data into other
> parts of the program. User A will export data into an Excel file and give it
> to User B who then imports that Excel file into their database. Since there
> are several Memo/Text fields in the data, the entire export is done doing
> automation writing each field's value cell by cell.
>
> Recently, we have discovered that in Excel 2007, although the Cell's Text
> field say 1/1/1900, when we query the Value property of that cell it reads as
> 12/31/1899 12:00:00 am. I could understand the date-time portion of this, but
> why does Excel subtract an entire day from the date specified in the Text?
> (Please note that the export simply sets the Cell's Text property without any
> further consideration to formatting to simulate the way in which a user would
> type into the Cell)
>
> I'm thinking this is a definite bug in Excel, but do not know how to report
> it to Microsoft. I also find it hard to believe that I would be the first
> person to discover this issue, so any help would be greatly appreciated....

 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      20th Apr 2010
I should have added that once past day 60 the 'bug' disappears and worksheets
and VB evaluate as the same
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Mike H" wrote:

> Hi,
>
> Well it is a bug but an intentional one.
>
> Excel followed on from Lotus 123 and in Lotus there was a genuine bug where
> it treated 1900 as a leap year when in fact is wasn't. In order to allow
> migration from Lotus to Excel without the need to change dates, Microsoft
> continued with the bug and do so to this day. VB displays the correct date
> for the value which is 1 day earlier.
> --
> Mike
>
> When competing hypotheses are otherwise equal, adopt the hypothesis that
> introduces the fewest assumptions while still sufficiently answering the
> question.
>
>
> "Travis Vandersypen" wrote:
>
> > A company I work for is using Excel to export and import data into other
> > parts of the program. User A will export data into an Excel file and give it
> > to User B who then imports that Excel file into their database. Since there
> > are several Memo/Text fields in the data, the entire export is done doing
> > automation writing each field's value cell by cell.
> >
> > Recently, we have discovered that in Excel 2007, although the Cell's Text
> > field say 1/1/1900, when we query the Value property of that cell it reads as
> > 12/31/1899 12:00:00 am. I could understand the date-time portion of this, but
> > why does Excel subtract an entire day from the date specified in the Text?
> > (Please note that the export simply sets the Cell's Text property without any
> > further consideration to formatting to simulate the way in which a user would
> > type into the Cell)
> >
> > I'm thinking this is a definite bug in Excel, but do not know how to report
> > it to Microsoft. I also find it hard to believe that I would be the first
> > person to discover this issue, so any help would be greatly appreciated....

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
combining dates and text in a cell Cecilia Microsoft Excel Worksheet Functions 1 19th Mar 2010 06:22 PM
split a cell diagonally in excell - a calendar -2 dates in 1 cell =?Utf-8?B?dmlja2k=?= Microsoft Excel Misc 1 31st Oct 2006 02:40 PM
select text in cell based on text from another cell, paste the text at the begining of a thrid cell, etc... jsd219 Microsoft Excel Programming 0 19th Oct 2006 05:04 PM
Text and dates into one cell without loosing date format =?Utf-8?B?SGF6ZWx0aW5l?= Microsoft Excel Misc 2 25th Apr 2006 07:05 PM
Text AND dates in the same cell =?Utf-8?B?c2ltc2py?= Microsoft Excel Programming 2 15th Sep 2004 10:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:58 AM.