View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Paige Paige is offline
external usenet poster
 
Posts: 270
Default # 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.