+ Reply to Thread
Results 1 to 4 of 4

number of days between two dates in european format

Hybrid View

  1. #1
    Registered User
    Join Date
    05-08-2006
    Posts
    19

    number of days between two dates in european format

    Hi

    I was trying to calculate number of days between two dates. The dates are in dd/mm/yyyy format. lets say in a1 31/03/2005 and in b1 its 28/02/2007. But when i try to put the formula =b1-a1 in c1 then its throwing up #value error.
    How do i rectify this.
    Thanks in advance

  2. #2
    Ardus Petus
    Guest

    Re: number of days between two dates in european format

    Works by me!
    It returns 699

    HTH
    --
    AP

    "manan" <manan.28754z_1148280313.716@excelforum-nospam.com> a écrit dans le
    message de news: manan.28754z_1148280313.716@excelforum-nospam.com...
    >
    > Hi
    >
    > I was trying to calculate number of days between two dates. The dates
    > are in dd/mm/yyyy format. lets say in a1 31/03/2005 and in b1 its
    > 28/02/2007. But when i try to put the formula =b1-a1 in c1 then its
    > throwing up #value error.
    > How do i rectify this.
    > Thanks in advance
    >
    >
    > --
    > manan
    > ------------------------------------------------------------------------
    > manan's Profile:
    > http://www.excelforum.com/member.php...o&userid=34216
    > View this thread: http://www.excelforum.com/showthread...hreadid=544167
    >




  3. #3
    Pete_UK
    Guest

    Re: number of days between two dates in european format

    If you are getting #VALUE, then perhaps A1 or B1 are actually text
    values which just look like dates. Use Format | Cells | Number tab to
    check - change if necessary, then edit the cell(s) with F2 to implement
    the change. Alternatively, change the formula in C1 to this:

    =VALUE(B1) - VALUE(A1)

    Hope this helps.

    Pete


  4. #4
    Agnieszka
    Guest

    Re: number of days between two dates in european format

    Hello Manan,

    Please find my example.
    I hope it helps.

    Sub DateDifference()
    Dim FirstDate As Date ' Declare variables.
    Dim SecondDate As Date
    FirstDate = InputBox("Enter a date")
    SecondDate = InputBox("Enter a date")
    Msg = "Days from second day to first day: " & DateDiff("d", FirstDate,
    SecondDate) & "," & _
    vbCr & "Months: " & DateDiff("m", FirstDate, SecondDate) & "," &
    _
    vbCr & "Years: " & DateDiff("yyyy", FirstDate, SecondDate) & "."
    MsgBox Msg

    End Sub

    Best Regards,

    Agnieszka


+ 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