Windows 7 Forums
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
 
 
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 SpecsSystem Spec
.
26 May 2010   #2
Dwarf

Windows 8.1 Pro RTM x64
 
 

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 SpecsSystem Spec
26 May 2010   #3
jorpe

7600x64 ultimate, not SP1
 
 

Thank you, I didn't realize I could subtract dates like that.
My System SpecsSystem Spec
.

26 May 2010   #4
Dwarf

Windows 8.1 Pro RTM x64
 
 

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 SpecsSystem Spec
Reply

 excel syntax problem for formula... difference in days




Thread Tools




Similar help and support threads
Thread Forum
Excel 2013 - how to keep a formula consisten
Hi I am trying to tie one cell into a formula that is being pasted into multiple rows. I know you can use $ to keep the cell consistent but it doesn't seem to be working. So if the value is in c9 and then first row gets c9 then the new row gets c10 etc... I need it to be c9 throughout the...
Microsoft Office
Excel Formula
Hello Sir, Can you let me know the formula in Excel: I have a table as below: This table, At the column "A,Status" when i Put the word" Completed", it's will automatic put current Date to Column "B, Row 2". But i don't know after that when tomorrow arrived,at the column "B,Row 2",...
Microsoft Office
Excel 2003 sum formula problem
I have been entering currency data in Column B in Euros to an EXCEL 2003 s/s and the formula used has added these totals entered in that Column correctly until I reached a total sum of 74364.70 Euros ,this being the sum of entries in Rows B6 to B82 . This was reached with the formula showing as...
Microsoft Office
Want to copy data and formula from one Excel Sheet to another.
I have a budget workbook set up in Excel, and in that workbook there are many different sheets all part of the one book. I have created a formula in one sheet from the data that is collected there, and that data is important for information collected on another sheet. I want to copy the...
Microsoft Office
Excel Formula Help please...
This is probably very simple and I have got it working but it isn't working how I want it to work. I have created an Excel document to show my monthly payments of a bank loan. I have created 3 columns in the first column is the payment number, in the second column is the amount that the loan...
Microsoft Office
Cant scroll while editing formula Excel 2007
Hi I'm unable to scroll while editig a formula in excel 2007. i know it can be done if i edit directly in cell but i prefer editing in the formula bar. I've seen an apparent solution in some forum which says change the mouse setting in the control panel (the wheel tab). Start --> Settings -->...
Microsoft Office


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 13:56.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App