# Subtracting Two Dates

#### EDJC

##### New Member
I have two questions. What would the formula be for subtracting two dates to get the numbers of years, months? I cannot get my formula to work.

Also, can Excel take a telephone number such as (555)-555-5555 can place the phone number in another field such as 555-555-5555?

Thank you for any assistance you may offer, I appreciate it,
Ed

### Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

#### Stormseed

##### Banned
Regarding your first question, you can use =DATEDIF("Start Date","End Date","y").

Note: You can mention "y" in order to get difference in years, "d" in order to get the difference in days and "m" to get the difference in months.

#### Mike Blackman

##### Well-known Member
As for the second question, does this work for you?

=SUBSTITUTE(SUBSTITUTE(A1,"(",""),")","")

#### EDJC

##### New Member
Stormseed, thank you for the prompt response. I used your formula of
=DATEDIF(F2,C8,Y) I have the two dates defined at dates. I get the error of #NAME?

Thank you.

#### Stormseed

##### Banned
Which version of Excel do you use on your computer ?

#### Mike Blackman

##### Well-known Member
Can you not just do a normal subtract?

=A1-B1

And format the cell to "yy" if you only want to return the year?

#### snowblizz

##### Well-known Member
You need to put quote signs on the last variable i.e. "y" at least in 2007.

#### Stormseed

##### Banned
The exact format would be:

=DATEDIF("Start Date","End Date","y") where the start date is the reference to cell with the Starting Date and End Date would be the reference to the cell and letter y for years, m for months and d for days whould be in double quotes.

Alternatively, can you please let us know if you want to find the difference between dates in the same year ?

#### EDJC

##### New Member
I am using version Excel 2000.

I put the quotes on "Y", and it's still returning the error. I thought I could just do a normal subtract but it returns the following: 3/27/2009 - 3/27/2003 returns 2192.00

Ed

Replies
1
Views
1K
Replies
1
Views
267
Replies
0
Views
413
Replies
3
Views
308
Replies
2
Views
313

1,191,069
Messages
5,984,448
Members
439,888
Latest member
c3rberus

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back