Wednesday, July 16, 2014

DAYS of Our Lives

How Excel handles dates and anything having to do with The Days of Our Lives, is always interesting to me, as it can at times be a bit less than intuitive.  For instance, simply subtracting two dates may give you the number of days between the dates, or it may create an error.  So what should you do?

The new DAYS function which was first introduced in Excel 2013 can help assure that you are getting the results you are seeking.  It is, of course, not terribly sophisticated, but it can come in handy at times.  One of the key features is that if either one of the date arguments is text, the DAYS function automatically kicks in the DATEVALUE function and returns an integer date.  

The syntax is:  =DAYS(end_date, start_date)

A simple example is shown below, where the formula, =DAYS(C3,B3) has been entered in cell D3 producing the result 196.

For something a little bit more interesting, let’s say you have a workbook that you use daily, and you would like to have a continually updated note of how many days it has been since the beginning of the current year.  Here is an example of an easy way to do this using the DAYS function, along with the TODAY function.  The formula, =DAYS(TODAY(), B2) is placed in cell C2, and automatically updates (pretty cool, eh?) every day:
The DAYS function.  Helping you avoid being in a DAZE in Excel (I know, I know, I have no shame…).

No comments: