+ Reply to Thread
Results 1 to 4 of 4

# of Days in a Year

  1. #1
    Paige
    Guest

    # of Days in a Year

    Is there a way to tell Excel (in VB or otherwise) to calculate the difference
    between 2 dates based solely upon 365 days a year, ignoring whether it is a
    leap year or not? I researched various VB/Excel sites and the internet, and
    couldn't find an answer to this.

  2. #2
    Tom Ogilvy
    Guest

    RE: # of Days in a Year

    Could you work out a formula or algorithm to do that - I would guess you
    could.

    Is there a built in function that does it. No.

    Are you asking what the algorithm would be? Define what the answer is? You
    would the number of days minus any leap days?

    --
    Regards,
    Tom Ogilvy


    "Paige" wrote:

    > Is there a way to tell Excel (in VB or otherwise) to calculate the difference
    > between 2 dates based solely upon 365 days a year, ignoring whether it is a
    > leap year or not? I researched various VB/Excel sites and the internet, and
    > couldn't find an answer to this.


  3. #3
    Don Guillett
    Guest

    Re: # of Days in a Year

    not tested
    =DAYS360(E11,E10)+(5*(YEAR(E10)-YEAR(E11)))

    --
    Don Guillett
    SalesAid Software
    [email protected]
    "Paige" <[email protected]> wrote in message
    news:[email protected]...
    > Is there a way to tell Excel (in VB or otherwise) to calculate the
    > difference
    > between 2 dates based solely upon 365 days a year, ignoring whether it is
    > a
    > leap year or not? I researched various VB/Excel sites and the internet,
    > and
    > couldn't find an answer to this.




  4. #4
    Paige
    Guest

    Re: # of Days in a Year

    Don and Tom:
    Tried Don's method and unfortunately it doesn't hold true in all scenarios,
    but it was an excellent suggestion. Yes, I'm looking for some type of
    formula, which I will eventually make into a custom function in VB. I have 2
    dates; they could be in the same year or in different years. Date360 and add
    5 days for each year is essentially what I'm trying to do; i.e., have a
    formula that calculates strictly based upon 365 days a year....not 360 and
    not the normal way of calculating which includes leap year consideration.
    The formulas I've tried calculate correctly in some scenarios but not in
    others; for example, one formula may work if both the start and end dates are
    in leap years, but won't if the start date is in a leap year and the end date
    is not; sometimes I can't figure out any rhyme or reason to why one formula
    works/doesn't work. I tried calculating the number of full years * 365, then
    the # of days from 1/1/xx to the start date (ignoring the extra leap day if
    applicable), then the # of days from the end date to 12/31/xx (ignoring the
    extra leap day if applicable) and adding them all together, but that was
    really ugly and I couldn't get it to work either. I just can't seem to get
    my brain around this.

    "Don Guillett" wrote:

    > not tested
    > =DAYS360(E11,E10)+(5*(YEAR(E10)-YEAR(E11)))
    >
    > --
    > Don Guillett
    > SalesAid Software
    > [email protected]
    > "Paige" <[email protected]> wrote in message
    > news:[email protected]...
    > > Is there a way to tell Excel (in VB or otherwise) to calculate the
    > > difference
    > > between 2 dates based solely upon 365 days a year, ignoring whether it is
    > > a
    > > leap year or not? I researched various VB/Excel sites and the internet,
    > > and
    > > couldn't find an answer to this.

    >
    >
    >


+ 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