+ Reply to Thread
Results 1 to 6 of 6

Calculating Date difference in 2 ways

  1. #1
    Hari
    Guest

    Calculating Date difference in 2 ways

    Hi,

    If in cell A1 I write -- = today() - date(2004,12,31)
    then the answer I get is a number ( let's say 14 or 15)

    But if in cell B1 If i write -- = C1 - D1
    where C1 -- = Today() and D1 -- = date(2004,12,31), the answer I get is
    in date format (in excel's 1900 base year)

    Why is there a diference in formatting of results between the above 2
    approaches.

    Regards,
    Hari
    India


  2. #2
    Jim May
    Guest

    Re: Calculating Date difference in 2 ways

    Format Cell (B1) as a Number.

    "Hari" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > If in cell A1 I write -- = today() - date(2004,12,31)
    > then the answer I get is a number ( let's say 14 or 15)
    >
    > But if in cell B1 If i write -- = C1 - D1
    > where C1 -- = Today() and D1 -- = date(2004,12,31), the answer I get is
    > in date format (in excel's 1900 base year)
    >
    > Why is there a diference in formatting of results between the above 2
    > approaches.
    >
    > Regards,
    > Hari
    > India
    >




  3. #3
    Aladin Akyurek
    Guest

    Re: Calculating Date difference in 2 ways

    Excel's guess of the result type is wrong. Just format the formula cell
    as General.

    Hari wrote:
    > Hi,
    >
    > If in cell A1 I write -- = today() - date(2004,12,31)
    > then the answer I get is a number ( let's say 14 or 15)
    >
    > But if in cell B1 If i write -- = C1 - D1
    > where C1 -- = Today() and D1 -- = date(2004,12,31), the answer I get is
    > in date format (in excel's 1900 base year)
    >
    > Why is there a diference in formatting of results between the above 2
    > approaches.
    >
    > Regards,
    > Hari
    > India
    >


  4. #4
    Hari
    Guest

    Re: Calculating Date difference in 2 ways

    Hi Jim and Aladin,

    I have not written my initial query properly.

    My doubt is that inspite of the same formulas and with both A1 and B1 having
    no previous formating, what causes excel to interpret these 2 approaches as
    being different. Is there some logical reason for the same.

    Regards,
    Hari
    India

    "Aladin Akyurek" <[email protected]> wrote in message
    news:[email protected]...
    > Excel's guess of the result type is wrong. Just format the formula cell
    > as General.
    >
    > Hari wrote:
    > > Hi,
    > >
    > > If in cell A1 I write -- = today() - date(2004,12,31)
    > > then the answer I get is a number ( let's say 14 or 15)
    > >
    > > But if in cell B1 If i write -- = C1 - D1
    > > where C1 -- = Today() and D1 -- = date(2004,12,31), the answer I get is
    > > in date format (in excel's 1900 base year)
    > >
    > > Why is there a diference in formatting of results between the above 2
    > > approaches.
    > >
    > > Regards,
    > > Hari
    > > India
    > >




  5. #5
    Aladin Akyurek
    Guest

    Re: Calculating Date difference in 2 ways

    Hari wrote:
    > Hi Jim and Aladin,
    >
    > I have not written my initial query properly.
    >
    > My doubt is that inspite of the same formulas and with both A1 and B1 having
    > no previous formating, what causes excel to interpret these 2 approaches as
    > being different. Is there some logical reason for the same.
    >
    > Regards,
    > Hari
    > India
    >
    > "Aladin Akyurek" <[email protected]> wrote in message
    > news:[email protected]...
    >
    >>Excel's guess of the result type is wrong. Just format the formula cell
    >>as General.
    >>
    >>Hari wrote:
    >>


    The second formula references cells whose formats are dates. Excel
    apparently uses that format info in its guess what the format of the
    result will be.

    >>>Hi,
    >>>
    >>>If in cell A1 I write -- = today() - date(2004,12,31)
    >>>then the answer I get is a number ( let's say 14 or 15)
    >>>
    >>>But if in cell B1 If i write -- = C1 - D1
    >>>where C1 -- = Today() and D1 -- = date(2004,12,31), the answer I get is
    >>>in date format (in excel's 1900 base year)
    >>>
    >>>Why is there a diference in formatting of results between the above 2
    >>>approaches.
    >>>
    >>>Regards,
    >>>Hari
    >>>India
    >>>

    >
    >
    >


  6. #6
    Frans van Zelm
    Guest

    Re: Calculating Date difference in 2 ways

    Hi Hari,

    Some number formats in source cells are echoes in targets. This is a
    built-in
    feature, weather you like it or not.

    E.g.: if you multiply $5 by 2, the result automatically will be $10.

    Frans

    "Hari" <[email protected]> wrote in message
    news:uCWT$%23z%[email protected]...
    > Hi Jim and Aladin,
    >
    > I have not written my initial query properly.
    >
    > My doubt is that inspite of the same formulas and with both A1 and B1

    having
    > no previous formating, what causes excel to interpret these 2 approaches

    as
    > being different. Is there some logical reason for the same.
    >
    > Regards,
    > Hari
    > India
    >
    > "Aladin Akyurek" <[email protected]> wrote in message
    > news:[email protected]...
    > > Excel's guess of the result type is wrong. Just format the formula cell
    > > as General.
    > >
    > > Hari wrote:
    > > > Hi,
    > > >
    > > > If in cell A1 I write -- = today() - date(2004,12,31)
    > > > then the answer I get is a number ( let's say 14 or 15)
    > > >
    > > > But if in cell B1 If i write -- = C1 - D1
    > > > where C1 -- = Today() and D1 -- = date(2004,12,31), the answer I get

    is
    > > > in date format (in excel's 1900 base year)
    > > >
    > > > Why is there a diference in formatting of results between the above 2
    > > > approaches.
    > > >
    > > > Regards,
    > > > Hari
    > > > India
    > > >

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1