(e-mail address removed) wrote...
ok well that 'Date' worksheet function is uh.. known as DateSerial in
the VB world.
There's lots different between VB and Excel worksheet functions.
I want to add a month to it.
Simplistically,
=DATE(YEAR(x),MONTH(x)+1,DAY(x))
but if x were 31-May-2005, this would return 1-Jul-2005. If you want
30-Jun-2005 instead, it gets more complicated.
=DATE(YEAR(x),MONTH(x)+1,MIN(DAY(x),DAY(DATE(YEAR(x),MONTH(x)+2,0))))
or
=x+31-DAY(x+31)+(MONTH(x+31)-MONTH(x)=1)*DAY(x)
or if you load the Analysis ToolPak
=EDATE(x,1)
I want to add a day to it.
=x+1
I want to add a year to it.
Either
=DATE(YEAR(x)+1,MONTH(x),DAY(x))
which only screws up if x were 29-Feb in a leap year, or
=x+365+(DAY(x) said:
I just think that these functions should be standardized.. across
EVERYTHING.
Fine, but what criteria would be used to establish 'THE ONE TRUE WAY!'?
First language to provide the feature? Then we'd probably be stuck with
the COBOL or PL/I function.
Democratically by number of users using an existing common feature
named differently in different systems? Then get used to the Excel way
of doing things.
Aaron's preference? Become world dictator, then you can impose your
will. Until then, hold your breath.
SQL SERVER doesnt have a 'DATE' function-- it has a
A . . . what?
and in VB DATE() is a totally different function.
VB's Date is an OLD, OLD function from the original Dartmouth Time
Sharing System BASIC that Microsoft, in it's infinite marketing wisdom,
decided not to redefine in its BASIC dialects.
Excel's DATE function comes from 123's @DATE. No prizes for guessing
why.
If nothing else there should be help in Excel when you lookup 'DateAdd'
it should say 'sorry excel is too retarded to have these standard
functions'.
No, it should say, "YOU'RE NOT USING SQL, MORON!, YOU'RE USING EXCEL."