Group:  Microsoft Excel ยป microsoft.public.excel.worksheet.functions
Thread: Using dates as function arguments in Excel

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Using dates as function arguments in Excel
johnston 22.09.2006 22:46:01
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.
RE: Using dates as function arguments in Excel
Anthony D 23.09.2006 00:58:01
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

"johnston" wrote:

[Quoted Text]
> 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.
RE: Using dates as function arguments in Excel
johnston 23.09.2006 13:37:01
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:

[Quoted Text]
> 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
>
> "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.

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net