Excel Spreadsheets Date and Time Functions (21)
Note: The DATEDIF function does not show in the drop-down list of Excel functions (even in Excel 2007).
In annex 2 you have found a description of all 21 Excel functions in the "Date and Time" category. Below is the list of the 9 most useful ones.
The three most important things that you should remember when working with dates and times are:
If you have the dates 1/16/2005 in cell A1 and 1/22/2005 in cell B1
If you have a date in cell A1 and you want the date for the next day in cell B1 (formatted "date" ) the formula will be:
Tips on Excel Date and Time Functions and Formulas
If you enter the date 2/1/2005 in cell A1 and the number format of the cell is " General" you will see 38394. This is a " Serial number" and it is the way Excel works with dates and times. When you format the cell or use one of the functions below the serial number is viewed as times and dates
To enter the date of the day no need to key it in, click and hold the CTRL key and click on the semi-colon key ( ) and there is the date.
To enter the time, click and hold both the Shift and the CTRL keys and click on the colon key (:) and there is the time.
Microsoft Excel doesn't work with dates and times, it works with serial numbers This means that when you enter 12/25/2004 Excel sees 38346 and if you enter 12/26/2004 Excel sees 38347. When you enter 12:00:00 PM Excel reads 0.5 and if you write 12:00:01 PM Excel reads 0.5000116. It is when you format the cell " Format/Cells" that you can read dates and times as we humans are accustomed to see them.
By the way, I was born on 18373 at 0.25 so I am an Aries, and you?
This being said, most functions of the category Date & Time are quite easy to work with when you use the right cell format. For example, when you are adding times and expect the total to be over 24 hours you must set the format of the result cell to " Format/Cells/Time/37:30:55"
If you develop a time management application don't go through the trouble of working with clock time. Ask your people to enter either the number of hours worked by projects or the number of minutes then work with regular numbers. Much easier.
Examples of basic Excel Date and Time Formulas
One note to start. If you go to the menu " Insert/Function" you won't find this function. Excel has forgotten it. Here is how it works. Let's say that you have the dates 1/16/2005 in cell A1 and 1/16/2006 in cell B1:
DAY, MONTH, YEAR
With a date in A1 like 12/15/2005 the formulas =DAY(A1), =MONTH(A1) and =YEAR(A1) will return 15, 12 and 2005.
SECOND, MINUTE, HOUR
With a TIME in A1 like 1:31:45PM the formulas =SECOND(A1), =MINUTE(A1) and =HOUR(A1) will return 1, 31 and 45.
If the date in A1 is 1/16/2006 and it is a Monday the formula =WEEKDAY(A1) will return 2. For most users day 1 is Sunday. Check what your system says because in some cases day 1 is Monday.
DATE, DAY, MONTH, YEAR
With the DATE function, the arguments are always in the following order (year,month,day) whatever the date format specified in your regional parameters.
With a date in cell A1
MONTH, DAY, NOW, AND and IF (Anniversary Alerts)
My client wanted a spreadsheet that would tell her when it is the birthday of an employee. We created a spreadsheet with the names in column A and the dates of birth in column B. In column D was this formula =NOW() that changes date each day. In column C we put this formula:
We fine tuned:
Copy/paste the formula above in your spreadsheet. If you want to be alerted more that a week before the anniversary change the 7 for 30 in the formula. This way you will be alerted a month in advance.
If you are using a version of Excel earlier than 2007 you need to activate the " Excel Analysis Toolpack" to make a few of the functions above available.
SUMPRODUCT ¦ INDEX/MATCH ¦ SUBTOTAL ¦ ISERROR ¦ HLOOKUP ¦ LOOKUP ¦ VLOOKUP
AVERAGEIF ¦ AVERAGEIFS ¦ COUNTIF ¦ COUNTIFS ¦ SUMIF ¦ SUMIFS ¦ IFERROR