View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
David Biddulph[_2_] David Biddulph[_2_] is offline
external usenet poster
 
Posts: 8,651
Default Excluding leap days in a formula

I'm not sure why you are using =DATEDIF(A1,A2,"d") instead of =A2-A1, but it
may be worth trying:
=(YEAR(A2)-YEAR(A1)-((YEAR(A2)-YEAR(A1))DATEDIF(A1,A2,"y")))*365+DATEDIF(A1,A2," yd")You may, of course, be able to simplify that.I assume that if there is more than one Feb 29 in the period, you want tosubtract one for each?--David Biddulph"PMBO" wrote in ... Ron - I'm using a simple datedif =DATEDIF(A1,A2,"d") "Ron Rosenfeld" wrote: On Thu, 11 Dec 2008 05:05:00 -0800, PMBO wrote: Is there an excel function which could subtract (-1) from a formula ifthe dates included the leap day? I don't want to count that one additionalday in a leap year; I know I can include a -1 in my formula, but I'm lookingfor something that will decide if it's a leap year and automaticallysubtract it from my date difference formula. Your formula can be altered to not count Feb 29. Post your formula andsomeone will show you how to account for that. --ron