Using dates as function arguments in Excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am looking for a reliable way to use the numbers obtained when doing
arithmetic functions on dates as input for a subsequent calculation. For
example, when subtracting dates, I get an error message. This can be
corrected by resetting the format of the cell to "general," but this would
be too onerous to do every time. I also need a way to do this when
subtracting an earlier date from a later date, which would yield a negative
number. Thanks.
 
Hi Johnston,

If the following is entered into a cell which has the general format it will
retain the format.
=IF(A1>A2,A1-A2,-(A2-A1))
assuming dates in a1 and a2

Hope that is helpful

Anthony
 
Hi Anthony,

Thanks for the reply. That works, but I may have uncovered another problem.
Even when subtracting dates (earlier from a later to give a positive #),
excel is changing the cell format to a custom format rather than retaining
the general format.

Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top