+ Reply to Thread
Results 1 to 6 of 6

Calculating Days Between Dates

  1. #1
    Forum Contributor
    Join Date
    02-16-2006
    Posts
    200

    Calculating Days Between Dates

    I use the following formula to calculate the days between dates and to return zero when dates are the same –

    =IF(OR(A1="",A2=""),0,DATEDIF(A1,A2, "d"))
    How would I also allow for the eventuality where the date in cell A2 is earlier than A1 and where the result would then be a minus figure ?

    At present the formula returns a "Num" error when this happens

  2. #2
    Dave Peterson
    Guest

    Re: Calculating Days Between Dates

    If you're just counting the days between dates:

    =a1-a2

    (but format it as a number or general.)

    martins wrote:
    >
    > I use the following formula to calculate the days between dates and to
    > return zero when dates are the same –
    >
    > =IF(OR(A1="",A2=""),0,DATEDIF(A1,A2, "d"))
    > How would I also allow for the eventuality where the date in cell A2 is
    > earlier than A1 and where the result would then be a minus figure ?
    >
    > At present the formula returns a "Num" error when this happens
    >
    > --
    > martins
    > ------------------------------------------------------------------------
    > martins's Profile: http://www.excelforum.com/member.php...o&userid=31616
    > View this thread: http://www.excelforum.com/showthread...hreadid=526265


    --

    Dave Peterson

  3. #3
    Forum Contributor
    Join Date
    02-16-2006
    Posts
    200
    Tried this but doeasnt seem to work or maybe I'm entering the formula incorrectly - are you suggesting to substitue part of the formula ar as an add in? could you clarify the whole formula

    Thanks

  4. #4
    Dave Peterson
    Guest

    Re: Calculating Days Between Dates

    I'm just suggestion that you subtract one date from the other. You could add
    your checks like:

    =IF(OR(A1="",A2=""),0,a2-a1)





    martins wrote:
    >
    > Tried this but doeasnt seem to work or maybe I'm entering the formula
    > incorrectly - are you suggesting to substitue part of the formula ar as
    > an add in? could you clarify the whole formula
    >
    > Thanks
    >
    > --
    > martins
    > ------------------------------------------------------------------------
    > martins's Profile: http://www.excelforum.com/member.php...o&userid=31616
    > View this thread: http://www.excelforum.com/showthread...hreadid=526265


    --

    Dave Peterson

  5. #5
    Forum Contributor
    Join Date
    02-16-2006
    Posts
    200
    yes many thanks - I know understand - does the job well

  6. #6
    FSt1
    Guest

    RE: Calculating Days Between Dates

    hi,
    Try this. drop the dateif part and just use the cell addresses
    =IF(OR(A1="",A2=""),0,A1-A2))

    regards
    FSt1

    "martins" wrote:

    >
    > I use the following formula to calculate the days between dates and to
    > return zero when dates are the same –
    >
    > =IF(OR(A1="",A2=""),0,DATEDIF(A1,A2, "d"))
    > How would I also allow for the eventuality where the date in cell A2 is
    > earlier than A1 and where the result would then be a minus figure ?
    >
    > At present the formula returns a "Num" error when this happens
    >
    >
    > --
    > martins
    > ------------------------------------------------------------------------
    > martins's Profile: http://www.excelforum.com/member.php...o&userid=31616
    > View this thread: http://www.excelforum.com/showthread...hreadid=526265
    >
    >


+ 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