View Single Post
  #9   Report Post  
Dave Peterson
 
Posts: n/a
Default

Try:
=a1-a2
if both are just plain old dates.

Format the cell as General (or some number format).




Peter Rooney wrote:

Chip,

Talk about setting myself up for a fall..!

...except that I can't make it work. If I subtract a cell containing a
formula created in this way from a cell with a non-string date in it, I get
#VALUE!

If I subtract the cell from a cell with another string date in it, I get the
same thing.

And if I use datevalue(a1)-datevalue(a2) where both cells contain string
dates, I get the same thing too.

What am I doing wrong?

And to think this started off as someone ELSE's problem :o)

Pete

"Chip Pearson" wrote:

Peter,

You can certainly do date arithmetic on the date value in the
cell.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Peter Rooney" wrote in
message
...
Chip,

The only problem with this is it returns a label, which isn't
helpful if you
want to do date maths (I know this contributor didn't say he
wanted to, but I
do quite a lot)
My suggestion, although a bit unwieldy, does give you a
"valued" and
"mathable" date.
By the way, your web site is superb! Keep up the good work!

Pete (waiting to be proved wrong on the above...)



"Chip Pearson" wrote:

Use code like

ActiveCell.Value = Format(Now,"mm/dd/yyyy")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"mrbalaje" wrote in
message
...
I am using macros in my excel sheets. Can anyone tell me how
i
can assign the
current date using macros.







--

Dave Peterson