Skip to main content

The Date Function 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.

The Excel Date Function

As an example of how to use date functions in Excel, we'll contruct as simple spreadsheets for an order form. We'll enter the date an order was taken, the date the order was sent, and how long it took to be processed. So, to make a start, create the spreadsheet below :
A Simple Excel 2007 Order Form
Click inside cell A2, and we'll enter a date. To enter a date, Click on the Formulas menu at the top of Excel. Then locate the Function Library panel. From the Function Library panel, click on Date & Time:
The Date and Time panel in Excel 2007
As you can see, there's quite a lot of Date and Time functions! Click on Date from the menu, and you'll get the following dialogue box:
The Function Arguments dialogue box
You're now being asked enter a full date.
  • In the Year box, enter 2016
  • In the Month box, enter the number 4
  • In the Day box, enter the number 15
  • Click the OK button
  • Excel will enter the Date in your selected cell, A2 for us
A date entered in an Excel Cell
Notice the DATE Function in the Formula bar:
=DATE(2016, 4, 15)
Between the round brackets of DATE, the Year comes first, then the Month, then the Day.
If you want to format your date as say Monday 15th of April, then you need to click on the Hometab from the Ribbon at the top of Excel. Locate the Nmumber panel, and you'll see Date already displayed:
The Date option in the Number panel in Excel 2007
Click the down arrow to see more options:
Long Date in Excel 2007
Click the Long Date item. Or click on More at the bottom to see some more Date formats to choose from. Your spreadsheet will then look like this:
A Date entered into cell A2 of an Excel spreadsheet
In cell B2, under your Date Order Sent heading, enter another Date Function. This time, have the date read May 3, 2016:
Another date entered
In cell C2, under Time Taken, we'll work out how many days the order took to be sent out.

The Days360 Function in Excel

When you want to work out how many days there are between two dates, the function to use is Days360( ). We want to work out how many days there are between the 15th of April 2016 and the 3rd of May 2016. So click inside cell C2 and do the following:
Click on the Formulas tab at the top of Excel. Then locate the Function Library panel. From the Function Library panel, click on Date & Time. From the menu, click on Days360(). You should see the Function Arguments dialogue box appear again. This time, it will look like this:
Days360 in Excel
The Days360 function needs a start date and an end date. You can enter your cell references here. So in the Start_date box, enter A2. In the End_Date box, enter B2. If you enter the word True in the Method box, Excel will calculate using the European date system. Click OK, to return to your spreadsheet and you might see this:
The wrong cell format
(If your C2 cell has a lot of #### symbols in it, it means that your column is not wide enough. Widen the C column and they'll go away!)
The answer we got was January 18th 1900! The reason for such a bizarre answer is that we've formatted the C2 cell as a date. But the answer to the Days360 function is not a date - it's a number. If you have the same strange answer, then format your C2 as a number. Your spreadsheet will then look like ours below:
Format the cell as a Number
So the difference between the two dates is 18 days.
Entering dates can be fairly straightforward, like cells A2 and B2. But performing calculations with dates can be slightly more complex. To get you some more practise, here's an exercise.

Exercise
Use a Days360 function to work out how many days are left before your next birthday.
Instead of typing out the current date in say cell A2, you can use this inbuilt function:
=Now( )
The Now function doesn't need anything between the round brackets. Once you have today's date, you can enter your birthday in say cell B2.

In the next part, we'll take a look at how to handle Time functions in Excel .

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...