Functions for working with dates in Excel: the examples of using

For work with dates in Excel, in the category «Date and time» is defined in the functions section. Let`s consider the most prevalent functions in this category.



How Excel Processes Time

The Excel program «perceives» the date and time as an ordinary number. The spreadsheet converts to such number, equating the day to unity. As a result, the time value represents a fraction of unity. For example, 12. 00 - is 0. 5.

The date value to the spreadsheet converts to a number which equal to the number of days from January 1, 1900 (so the developers decided) to the specified date. For example, when converting the date 13. 04. 1987, the number is 31880. That is, from 1. 01. 1900 passed 31. 880 days.

This principle underlies in the basis of the calculations of the time data. To find the number of days between two dates, it`s enough to take an earlier period from a later time one.



The example of DATE function

You need to describe of the date value with compiling it with individual elements of numbers.

There is the syntax: year; month, day.

All arguments are required. They can be specified by numbers or by reference to cells with the corresponding numeric data: for the year - from 1900 to 9999; for the month - from 1 to 12; for the day - from 1 to 31.

If you point a larger number for the «Day» argument (than the number of days in the pointed month), you receive the extra days, will be passed to the next month. For example, specifying 32 days for December, we will receive as a result on January 1.

The example of using the function:

example.

Let's set more days for June:

days June.

Examples of using the cell references as arguments:

cell references as arguments.

The DATEDIF function in Excel

It returns the difference between two dates.

The arguments:

  • start date;
  • final date;
  • the code indicating to the units of counting (days, months, years, etc.).

The methods of measuring intervals between the given dates:

  • to display the result in days - «d»;
  • in months – «m»;
  • in years – «y»;
  • in months without years – «ym»;
  • in days without months and years – «md»;
  • in days without years – «yd».

In some versions of Excel, if you use the last two arguments («md», «yd»), the function may give an error. It is better to use to alternative formulas.

The examples of the operation the DATEDIF function:

DATEDIF.

In Excel 2007 version, this function is not in the directory, but it works. But you need to check the results are better, because there are flaws possible.

The YEAR function in Excel

It returns the year as an integer number (from 1900 to 9999), what corresponds to the specified date. There is only one argument must be entered in the structure of the function – is the date in a numerical format. The argument must be entered using the DATE function or represents to the result of evaluating other formulas.

The example of using the YEAR function:

YEAR.

The MONTH function in Excel: the example

It returns the month as an integer number (from 1 to 12) for a date is specified in a numeric format. The argument – is the date of the month that you want to show in a numerical format. The dates in the text format this function does not handle correctly.

The examples of using the MONTH function:

MONTH.

The examples of DAY, WEEKDAY and functions WEEKNUM in Excel

It returns the day as an integer number (from 1 to 31) for a date specified in a numeric format. The argument – it is the date of the day you want to find in a numerical format.

DAY.

For returning of the weekday ordinal of the specified date, you can apply the function WEEKDAY:

WEEKDAY.

By default, the function considers Sunday the 1-st day of the week.

To display of the ordinal number of the week for the pointed date, you should use the WEEKNUM function:

WEEKNUM.

The date of 24. 05. 2015 is 22 week in a year. The week starts on Sunday (by default).

week starts.

As the second argument the figure 2 is specified. Therefore, the formula considers that the week starts on Monday (the 2-d day of the week).

Download all examples functions for working with dates

For indicating of the current date, the function TODAY (no arguments) is used. To display the current time and date, the function NOW() is used.


en ru