ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   # of Days in a Year (https://www.excelbanter.com/excel-programming/371031-days-year.html)

Paige

# 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.

Tom Ogilvy

# 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.


Don Guillett

# of Days in a Year
 
not tested
=DAYS360(E11,E10)+(5*(YEAR(E10)-YEAR(E11)))

--
Don Guillett
SalesAid Software

"Paige" wrote in message
...
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.




Paige

# 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

"Paige" wrote in message
...
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.






All times are GMT +1. The time now is 06:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com