# Thread: Calculate diff between dates (97)

1. ## Calculate diff between dates (97)

Hi all,

Can you please give me the formula and/or coding to calculate the difference between two dates. Also, what must the format of the cells be. I tried the following: cells formatted as date ie: 03/04/2000 and formula =networkdays(a1,b1,0) but this doesn't work.

Thanks a lot

2. ## Re: Calculate diff between dates (97)

Can you tell us what "but it doesn't work" means? Are you getting the wrong answer? An error? If so what error?

To use NetWorkDays, you must install the Analysis Toolpak (select Addins from the Tools menu and check Analysis Toolpak in the list).

This works for me to get the total number of days:

<pre>=DATEDIF(A1,B1,"D")
</pre>

And this works to get the number of workdays:

<pre>=NETWORKDAYS(A1,B1)
</pre>

3. ## Re: Calculate diff between dates (97)

Rene, I didn't have any problem with this. Try this simple exercise:
1) Enter 9/28/2001 in cell A1
2) Enter 10/20/2001 in cell B1
3) Enter =B1-A1+1 in cell C1
4) Use the Format, Cells menu & the number tab to format C1 as a number with 0 decimals. This gives the number of days (23).
5) Enter =NETWORKDAYS(A1,B1) in cell D1. This gives the number of working days (16).

Here in the US, for some of us 10/8/2001 was a holiday. If I enter 10/8/2001 in cell A3, and enter the formula =NETWORKDAYS(A1,B1,A3) in cell E1, then I get 15 as the result. See attachment for a little more fancy example. Hope this helps! --Sam

4. ## Re: Calculate diff between dates (97)

Thanks a lot Legare and Sam, both ways works 100%

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•