Using dates as function arguments in Excel
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
"Anthony D" wrote:
Hi Johnston,
If the following is entered into a cell which has the general format it will
retain the format.
=IF(A1A2,A1-A2,-(A2-A1))
assuming dates in a1 and a2
Hope that is helpful
Anthony
"johnston" wrote:
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.
|