Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subtracting dates in Excel

Status
Not open for further replies.

webjunk

MIS
Dec 28, 1999
42
0
0
US
How can I subtract dates in i have one date in on cell and the other date on another.

example: 10/17/03 - 10/16/03 = 1

I need to have the answer be the number of days between dates.

Thanks
 
webjunk,
Try this->

In cell "A1" type-> 10-17-2003
In cell "A2" type-> 09-13-2000

Difference is 3 Years, 1 Months and 4 Days
In cell "A3" paste this formula.
="Difference is "&DATEDIF(A2,(A1),"y")&" Years, "&DATEDIF(A2,(A1),"ym")&" Months and "&DATEDIF(A2,(A1),"md")&" Days"

Also is it always going to be compared to Todays date?
Because that would make a simpler formula.
tav

 
What is important to know is that Dates and Times in Excel are just NUMBERS.

Today at this very hour, the date/time number is 37911.63897
which can be FORMATTED (Format/Cells - Number tab and any number of date/time formats)

10/17/03 15:21 or
Fri, Oct 17, 2003 or
15:21:34

It's ALL THE SAME VALUE but it's FORMATTED AS YOU WISH.

That's why entering

10/17/2003

will give you FAR DIFFERENT RESULTS than if you enter

"10/17/2003"

Hope this all helps :)



Skip,
Skip@TheOfficeExperts.com
 
yes I misused the word format.

Webjunk asked for the answer in days, I gave it in a sentence form, which would still require some calculations to get it into days.
So I had to re-write it.

=""&DATEDIF(A2,(A1),"d")

Why I had to put ""& in the formula to get it to work is beyond me.
tav
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top