+ Reply to Thread
Results 1 to 9 of 9

Number of Days Count/Calculation?

  1. #1
    Registered User
    Join Date
    07-02-2007
    Posts
    10

    Number of Days Count/Calculation?

    I have a spreadsheet where I want to calculate the difference between Column A: Date Opened, and Column B: Due Date.

    My idea is that Column C would subtract the date in Column B from the date in Column A to then display an integer number.

    If the number in Column C is a negative number, then that task for the project is still ok and on-time. But, if the number is a positive number, then that would be a display of how many days past the Due Date that task is.

    Can anyone help me figure out the formula for this?

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    =IF(OR(A1="",B1=""),"",IF(B1-A1+1<0,"On time",B1-A1+1&" Days past due date"))

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    07-02-2007
    Posts
    10
    Thanks VBA.

    I pasted in your formula, but I got an error. It is:

    The formula you typed contains an error.
    • For information about fixing common formula problems, click Help.
    • To get assistance in entering a function, click OK, then click Function on the Insert menu.
    • If you are not trying to enter a formula, avoid using an equal sign (=) or minus sign (-), or precede it with a single quotation mark (').

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    See if this helps

    VBA Noob
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-02-2007
    Posts
    10
    Awesome!

    Thanks. Once I adjusted the formula to reference the correct columns and rows, (Column E instead of B, and Column D instead of A, and it began on row 2 with row 1 being column headers), it worked great!

    Thanks.

  6. #6
    Registered User
    Join Date
    07-02-2007
    Posts
    10
    Wait...

    I thought it was working, but it's not quite meeting my needs, and it is due to the fact that I failed to submit all of the elements for the spreadsheet.

    Column A: Date Opened
    Column B: Due Date
    Column C: Date Closed

    Column D: Calculates how long it took to do the task. If C is less than B, then it was "On time". If C is greater than B, then it is "Past Due".

    Can anyone help? VBA?

  7. #7
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    =IF(C2<B2,"On time",C2-B2+1&" Days past due date")

    VBA Noob

  8. #8
    Registered User
    Join Date
    07-02-2007
    Posts
    10
    Excellent.

    Thanks VBA. With your help I was able to improve my spreadsheet so it displays much better "human readable" data.

    Thanks again,
    Jon

  9. #9
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Glad it helped

    VBA Noob

+ 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