A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

possible DATEVALUE bug, workaround needed



 
 
Thread Tools Display Modes
  #1  
Old January 30th, 2004, 02:49 PM
Eliezer
external usenet poster
 
Posts: n/a
Default possible DATEVALUE bug, workaround needed

I have an excel sheet with a bunch of dates in the future,
and I need it to calculate how far away those dates are. I
found a way which works (mostly), but the other one I
tried seems to have unearthed a bug.

The way I was trying to do it was to have access convert
the future date and today's date to their DATEVALUE values
and subtract the two:

=DATEVALUE(E27)-DATEVALUE(NOW())

where E27 would be a date located six months or whatever
in the future. However, on further examination, excel
didn't seem to be able to recognize DATEVALUE(cellnumber).
Has anyone else noticed this?
  #4  
Old January 30th, 2004, 03:56 PM
SheilaD
external usenet poster
 
Posts: n/a
Default possible DATEVALUE bug, workaround needed

DATEVALUE converts a text value to a number ie =DATEVALUE("01/01/2004") would return the Julienne number for 30th Jan 2004
  #5  
Old January 30th, 2004, 04:21 PM
Sheila D
external usenet poster
 
Posts: n/a
Default possible DATEVALUE bug, workaround needed

I do of course mean the julienne number for 1st Jan 2004!!
  #6  
Old January 30th, 2004, 04:54 PM
Norman Harker
external usenet poster
 
Posts: n/a
Default possible DATEVALUE bug, workaround needed

Hi SheilaD!

They're not "julienne" numbers but Excel Date Serial Numbers.

For astronomers Julian day numbers are the number of days since
1-Jan-4713 BC with Day 0 starting UTC 12:00 Noon on 1-Jan-4713 and Day
0 starting 24 hours later. See:

http://www.tondering.dk/claus/cal/no...00000000000000

Julian numbers to programmers are the day number of a particular year.

"Julienne" numbers are those stringy vegetables you get in posh
restaurants vbg

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia

Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.


  #7  
Old January 30th, 2004, 06:19 PM
eykanal
external usenet poster
 
Posts: n/a
Default possible DATEVALUE bug, workaround needed

OK, so all that is well and good, but if E27 is "1/1/2003" and I write
=DATEVALUE(E27), it should give me the same thing as if I write
=DATEVALUE("1/1/2003"). It doesn't, though... the second one gives me
the datevalue (37622, in case you care), but the first one gives me a
#VALUE! message. Anyone know why?


---
Message posted from http://www.ExcelForum.com/

  #8  
Old January 30th, 2004, 08:15 PM
Harlan Grove
external usenet poster
 
Posts: n/a
Default possible DATEVALUE bug, workaround needed

"eykanal " wrote...
OK, so all that is well and good, but if E27 is "1/1/2003" and I write
=DATEVALUE(E27), it should give me the same thing as if I write
=DATEVALUE("1/1/2003"). It doesn't, though... the second one gives me
the datevalue (37622, in case you care), but the first one gives me a
#VALUE! message. Anyone know why?


First, original formula was

=DATEVALUE(E27)-DATEVALUE(NOW())

DATEVALUE(NOW()) should return #VALUE!, which should fubar your formula. Thi is
so because DATEVALUE only accepts text strings as its argument, but NOW()
returns a date value, a number rather than a text string.

Next, you may see something in E27 that appears to be the same as "1/1/2003",
but if it's actually a date value in "m/d/yyyy" or "d/m/yyyy" format (the former
appears to be the case), then DATEVALUE(E27) will return #VALUE! for exactly the
same reason it did when passed NOW() - it just can't handle numbers, even date
numbers. Another possibility is that you have trailing nonbreaking spaces in E27
following the date string. You can check this with the formula =LEN(E27). If it
returns 8, you have garbage space characters in E27 which you need to remove.
If it returns 8, E27 actually contains a date number, so DATEVALUE would be
superfluous even if it did work. If it returns 8 exactly and DATEVALUE(E27)
returns #VALUE!, you may have found a bug, but since Excel doesn't do that on my
machine, it's possible Excel is just corrupted on your machine, so a reinstall
would be in order.

--
To top-post is human, to bottom-post and snip is sublime.
  #9  
Old January 30th, 2004, 08:25 PM
Ron Rosenfeld
external usenet poster
 
Posts: n/a
Default possible DATEVALUE bug, workaround needed

On Fri, 30 Jan 2004 12:19:12 -0600, eykanal
wrote:

OK, so all that is well and good, but if E27 is "1/1/2003" and I write
=DATEVALUE(E27), it should give me the same thing as if I write
=DATEVALUE("1/1/2003"). It doesn't, though... the second one gives me
the datevalue (37622, in case you care), but the first one gives me a
#VALUE! message. Anyone know why?


Why? It's because the contents of E27 is *NOT* the text string "1/1/2003".
The contents of E27 is probably 37622 and E27's format displays it to look like
1/1/2003.

The formula =ISTEXT(E27) probably gives a result of FALSE.


--ron
  #10  
Old February 6th, 2004, 02:09 AM
Dave Ellis
external usenet poster
 
Posts: n/a
Default possible DATEVALUE bug, workaround needed


-----Original Message-----
On Fri, 30 Jan 2004 12:19:12 -0600, eykanal
wrote:

OK, so all that is well and good, but if E27 is

"1/1/2003" and I write
=DATEVALUE(E27), it should give me the same thing as if I

write
=DATEVALUE("1/1/2003"). It doesn't, though... the second

one gives me
the datevalue (37622, in case you care), but the first

one gives me a
#VALUE! message. Anyone know why?


Why? It's because the contents of E27 is *NOT* the text

string "1/1/2003".
The contents of E27 is probably 37622 and E27's format

displays it to look like
1/1/2003.

The formula =ISTEXT(E27) probably gives a result of FALSE.


--ron
.



Thanks to all on this thread, particularly Ron and harlan.
I was having exactly the same misunderstanding with Excel.
This may not facilitate what I'm trying to do, but it
certainly explainde the results, or lack thereof, that I
was achieving.

Changing the cell formatting from Date to Number displays
the datenumber, but failed to ring any bells. What Harlan
said opened my eyes and Ron's input about =istext confirmed it!

Again, Thanks!

Dave


 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:07 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.