Skip to main content

How to use the Date Functions in Excel


- There are a numbers of different reasons why you would want a Date or Time function in a spreadsheet: If you're running your own company, you might want to record when an order was received and when it was processed. You could then calculate the difference between the two, so that you check how fast the orders were being processed. We'll do that now.

Date Functions

Set up this simple spreadsheet in Excel
A simple spreadsheet with 3 columns
Click inside cell A3. To enter a date Function, do the following:
  • Click on Insert from the menu bar
  • From the drop down menu, click on Function
  • The Paste Function dialogue box appears
  • In the Function category section, click on Date & Time
  • In the Function name section, click on Date
  • Click the OK button at the bottom
  • The formula palette appears on your spreadsheet
The Date Function
What Excel wants you to do here is to enter some figures for the date. So:
  • Click inside the Year box and enter 2002
  • Click inside the Month box and enter the number 4 (The fourth month - April. Or you can enter any number you like here, the number for the current month, if you want)
  • Click inside the Day box and enter the number 15 (The 15th day - or enter another number, if you want.)
  • Click the OK button at the bottom
  • Excel enters the Date in cell A3
The Date appears in cell A3
Notice how the date Function is set out in the Formula box. It is set out as =Date(2002, 4, 15). However, in cell A3 the date is 4/15. It has missed out the year completely! Is there anything we can do to resolve the matter?
The reason Excel has missed the year out is because of the way cell A3 was formatted. To change the formatting of cell A3 (or any cell), click on Format form the menu bar. From the drop down menu, click on Cells. The format dialogue box appears. Click the Number tab strip at the top. Under Category, click on Date. A list of different date types appears in the Type list. The following picture shows this:
The Format Cells dialogue box
The Type section of the dialogue box is where you set how you want your date to look. At the moment, the first option is selected 3/14. Scroll down and click on March 14, 1998. Then click the OK button at the bottom. Your spreadsheet will now look like this one:
The year now appears in the cell
In cell B3, for the Date Order Sent, enter another Date Function. This time, have the date read May 3, 2002. Your spreadsheet will then look like this:
In cell C3, under Time Taken, we'll work out how long the order took to be sent out.

The Days360 Function in Excel

The Function to use when you want to work out how many days difference there are between two dates is the Date360( ) function. So click on cell C3 and do the following:
  • From the menu bar, click on Insert
  • From the drop down list, click on Function
  • The Paste Function dialogue box appears
  • Under Function category, click on Date & Time
  • Under Function name, click on Days360( )
  • Click the OK button at the bottom
  • The formula palette appears on your spreadsheet:
The Days360 Function
What Excel is looking for here is two dates: a start date and an end date. Our start date was in cell A3, and we can just enter the cell reference here. So click inside the Start_date box and enter A3. Next, click inside the End_date box and enter B3. Click inside the Method box and enter True (This will ensure that Excel calculates from the European date system.) Click the OK button when you're done. Your spreadsheet might look like the one below:
If your spreadsheet has all of those hash symbols in cell C3 it means that your column is not wide enough. So widen the C column until it takes all the date. Your spreadsheet might then look like this one:
As you can see, something has clearly gone wrong. Cell C3 reads January 18, 1900. The reason it is showing such a bizarre answer is because of the way the cell is formatted. We have C3 formatted as a date. But the answer to our Days360( ) function is not a date. The answer is a number. So we need to reformat that cell.
Format the cell C3 so that it is a number, and set the Decimal places to zero. Your spreadsheet will then show the correct answer, like the one below:
Entering dates can be fairly straightforward, like cells A3 and B3. But performing calculations with dates can be slightly more complex. To get you some more practice, try this exercise.

Exercise

The Mayor or Evercrease celebrates his official birthday on the 28th of June (Nobody knows his unofficial one). Work out how many days there are left to the Mayors official birthday party. After all, you are invited, so you need to start saving for his present.
To get the current date, you can use this function: =Now( ). You can then format the cell to get the date format you prefer.

In the next part, we'll take a look at the Time Function.

Comments

Popular posts from this blog

Beginners PHP  -This is a complete and free PHP programming course for beginners. It's assumed that you already have some HTML skills. But you don't need to be a guru, by any means. If you need a refresher on HTML, then click the link for the Web Design course on the left of this page. Everything you need to get started with this PHP course is set out in section one below. Good luck! Home Page > PHP Section One - An Introduction to PHP 1. What is PHP and Why do I need it? 2. What you need to get started 3. Installing and testing Wampserver 4. Troubleshooting > PHP Two - Getting Started With Variables 1. What is a Variable? 2. Putting text into variables 3. Variables - some practice 4. More variable practice 5. Joining direct text and variable data 6. Adding up in PHP 7. Subtraction 8. Multiplication 9. Division 10. Floating point numbers > PHP Three - Conditional Logic 1. If Statements 2. Using If Statements 3....
Visual Basic .NET Contents Page   -This computer course is an introduction to Visual Basic.NET programming for beginners. This course assumes that you have no programming experience whatsoever. It's a lot easier than you think, and can be a very rewarding hobby! You don't need to buy any software for this course! You can use the new FREE Visual Basic Express Edition from Microsoft. To see which version you need, click below: Getting the free Visual Studio Express - Which version do I need? > VB .NET One - Getting Started   1. Getting started with VB.NET 2. Visual Basic .NET Forms 3. Adding Controls using the Toolbox Home Page 4. Adding a Textbox to the Form 5. Visual Basic .NET and Properties 6. The Text Property 7. Adding a splash of colour 8. Saving your work 9. Create a New Project >   VB .NET Two - Write your first .NET code   1. What is a Variable? 2. Add a coding button to the Form 3. Writing y...
The Excel SumIF Function  - Another useful Excel function is SumIF. This function is like CountIf, except it adds one more argument: SUMIF( range ,  criteria ,  sum_range ) Range and criteria are the same as with  CountIF  - the range of cells to search, and what you want Excel to look for. The Sum_Range is like range, but it searches a new range of cells. To clarify all that, here's what we'll use SumIF for. (Start a new spreadsheet for this.) Five people have ordered goods from us. Some have paid us, but some haven't. The five people are Elisa, Kelly, Steven, Euan, and Holly. We'll use SumIF to calculate how much in total has been paid to us, and how much is still owed. So in Column A, enter the names: In Column B enter how much each person owes: In Column C, enter TRUE or FALSE values. TRUE means they have paid up, and FALSE means they haven't: Add two more labels: Total Paid, and Still Owed. Your spreadsheet should look something li...