Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

# Windows 7: excel syntax problem for formula... difference in days

 26 May 2010 #1 jorpe 7600x64 ultimate, not SP1 278 posts mile high excel syntax problem for formula... difference in days if I have 2 columns of dates and I want to find the number of days between the days of D2 and C2, what is the syntax for the formula so that the result in column E is x number of days between the two dates My System Specs
 .
 26 May 2010 #2 Dwarf Windows 8.1 Pro RTM x64 9,582 posts Doncaster, UK Format the columns as follows: Columns C and D as Date (you choose the specific date format). Column E as Number (with 0 Decimal places). The formula to use in Column E to give the difference in days is as follows (assuming that C is an earlier date than D): E=D-C (E2=D2-C2) If you want the number of days between, but not counting either day, then the formula is: E=D-C-1 (E2=D2-C2-1) If, on the other hand, you want to know the inclusive number of days, the formula is: E=D-C+1 (E2=D2-C2+1) Note that the above may yield negative results. To avoid that, use these modified formulae instead: E=ABS(D-C) (E2=ABS(D2-C2)) E=ABS(D-C)-1 (E2=ABS(D2-C2)-1) E=ABS(D-C)+1 (E2=ABS(D2-C2)+1) My System Specs
 26 May 2010 #3 jorpe 7600x64 ultimate, not SP1 278 posts mile high Thank you, I didn't realize I could subtract dates like that. My System Specs
 .
 26 May 2010 #4 Dwarf Windows 8.1 Pro RTM x64 9,582 posts Doncaster, UK You're welcome. Incidentally, if the dates happen to be the same (which is unlikely, but cannot be totally ruled out), then the following minor alteration to the relative formulae will take care of it (and are the versions that I recommend). E2=IF((D2==C2),0,ABS(D2-C2)) E2=IF((D2==C2),0,ABS(D2-C2)-1) E2=IF((D2==C2),0,ABS(D2-C2)+1) My System Specs