Articles | Photoshop blog | Photography blog | about me | e-mail

Helen Bradley - MS Office Tips, Tricks and Tutorials

I'm a lifestyle journalist and I've been writing about office productivity software for a long time. Here you'll find handy hints, tips, tricks, techniques and tutorials on using software as diverse as Excel, Word, PowerPoint, Outlook, Access and Publisher from Microsoft and other applications that I love. My publishing credits include PC Magazine, Windows XP mag, CNet, PC User mag, SmallbusinessComputing.com, Winplanet and Sydney Morning Herald.

Wednesday, February 7, 2007

Calculating elapsed time in Excel

It's a common enough scenario - you want to know how old you are in months or days or the number of days left in the year. There appears to be no Excel function for calculating the difference between two dates. Not so! there is a function and it's called Datedif.

The Excel Datedif function isn’t well known because it is largely undocumented in the Excel help files. Its purpose is to calculate the difference between two dates and it can do this by measure the distance using one of these attributes: "m" for months, "d" for days, "y" for years.

So this formula calculates the difference in months between FirstDate and SecondDate:

=Datedif(FirstDate,SecondDate,"m")

Replace "m" with "y" to get the result in years etc..

Always ensure that the first date occurs earlier than the second or you'll get an error.

Labels: , , ,

Add to Technorati Favorites