Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 Excel 2010 Excel 2007 Excel for Mac 2011 Excel Starter 2010 More…Less
To get detailed information about a function, click its name in the first column.
Note: Version markers indicate the version of Excel a function was introduced. These functions aren’t available in earlier versions. For example, a version marker of 2013 indicates that this function is available in Excel 2013 and all later versions.
Function |
Description |
DATE function |
Returns the serial number of a particular date |
DATEDIF function |
Calculates the number of days, months, or years between two dates. This function is useful in formulas where you need to calculate an age. |
DATEVALUE function |
Converts a date in the form of text to a serial number |
DAY function |
Converts a serial number to a day of the month |
DAYS function |
Returns the number of days between two dates |
DAYS360 function |
Calculates the number of days between two dates based on a 360-day year |
EDATE function |
Returns the serial number of the date that is the indicated number of months before or after the start date |
EOMONTH function |
Returns the serial number of the last day of the month before or after a specified number of months |
HOUR function |
Converts a serial number to an hour |
ISOWEEKNUM function |
Returns the number of the ISO week number of the year for a given date |
MINUTE function |
Converts a serial number to a minute |
MONTH function |
Converts a serial number to a month |
NETWORKDAYS function |
Returns the number of whole workdays between two dates |
NETWORKDAYS.INTL function |
Returns the number of whole workdays between two dates using parameters to indicate which and how many days are weekend days |
NOW function |
Returns the serial number of the current date and time |
SECOND function |
Converts a serial number to a second |
TIME function |
Returns the serial number of a particular time |
TIMEVALUE function |
Converts a time in the form of text to a serial number |
TODAY function |
Returns the serial number of today’s date |
WEEKDAY function |
Converts a serial number to a day of the week |
WEEKNUM function |
Converts a serial number to a number representing where the week falls numerically with a year |
WORKDAY function |
Returns the serial number of the date before or after a specified number of workdays |
WORKDAY.INTL function |
Returns the serial number of the date before or after a specified number of workdays using parameters to indicate which and how many days are weekend days |
YEAR function |
Converts a serial number to a year |
YEARFRAC function |
Returns the year fraction representing the number of whole days between start_date and end_date |
Important: The calculated results of formulas and some Excel worksheet functions may differ slightly between a Windows PC using x86 or x86-64 architecture and a Windows RT PC using ARM architecture. Learn more about the differences.
Need more help?
Want more options?
Explore subscription benefits, browse training courses, learn how to secure your device, and more.
Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.
Содержание
- Date and time functions (reference)
- DATE function
- How to Work With Date and Time Formulas in Excel
- Excel Date and Time Formulas (Quick Video Tutorial)
- Typing Dates and Times in Excel
- 1. How to Type Dates
- 2. How to Type Times
- 3. How to Type Date-Time Together
- Bonus: Excel Keyboard Shortcut for Current Time
- Formatting Dates in Excel
- Format Excel Cells
- Get Data From Dates and Times
- Find the Difference Between Dates and Times
- 1. Days Between Dates
- 2. Months Between Dates
- 3. Years Between Dates
- Bonus: Work Days Between Dates
- Recap and Keep Learning
Date and time functions (reference)
To get detailed information about a function, click its name in the first column.
Note: Version markers indicate the version of Excel a function was introduced. These functions aren’t available in earlier versions. For example, a version marker of 2013 indicates that this function is available in Excel 2013 and all later versions.
Returns the serial number of a particular date
Calculates the number of days, months, or years between two dates. This function is useful in formulas where you need to calculate an age.
Converts a date in the form of text to a serial number
Converts a serial number to a day of the month
DAYS function
Returns the number of days between two dates
Calculates the number of days between two dates based on a 360-day year
Returns the serial number of the date that is the indicated number of months before or after the start date
Returns the serial number of the last day of the month before or after a specified number of months
Converts a serial number to an hour
ISOWEEKNUM function
Returns the number of the ISO week number of the year for a given date
Converts a serial number to a minute
Converts a serial number to a month
Returns the number of whole workdays between two dates
NETWORKDAYS.INTL function
Returns the number of whole workdays between two dates using parameters to indicate which and how many days are weekend days
Returns the serial number of the current date and time
Converts a serial number to a second
Returns the serial number of a particular time
Converts a time in the form of text to a serial number
Returns the serial number of today’s date
Converts a serial number to a day of the week
Converts a serial number to a number representing where the week falls numerically with a year
Returns the serial number of the date before or after a specified number of workdays
WORKDAY.INTL function
Returns the serial number of the date before or after a specified number of workdays using parameters to indicate which and how many days are weekend days
Converts a serial number to a year
Returns the year fraction representing the number of whole days between start_date and end_date
Important: The calculated results of formulas and some Excel worksheet functions may differ slightly between a Windows PC using x86 or x86-64 architecture and a Windows RT PC using ARM architecture. Learn more about the differences.
Источник
DATE function
Use Excel’s DATE function when you need to take three separate values and combine them to form a date.
The DATE function returns the sequential serial number that represents a particular date.
The DATE function syntax has the following arguments:
Year Required. The value of the year argument can include one to four digits. Excel interprets the year argument according to the date system your computer is using. By default, Microsoft Excel for Windows uses the 1900 date system, which means the first date is January 1, 1900.
Tip: Use four digits for the year argument to prevent unwanted results. For example, «07» could mean «1907» or «2007.» Four digit years prevent confusion.
If year is between 0 (zero) and 1899 (inclusive), Excel adds that value to 1900 to calculate the year. For example, DATE(108,1,2) returns January 2, 2008 (1900+108).
If year is between 1900 and 9999 (inclusive), Excel uses that value as the year. For example, DATE(2008,1,2) returns January 2, 2008.
If year is less than 0 or is 10000 or greater, Excel returns the #NUM! error value.
Month Required. A positive or negative integer representing the month of the year from 1 to 12 (January to December).
If month is greater than 12, month adds that number of months to the first month in the year specified. For example, DATE(2008,14,2) returns the serial number representing February 2, 2009.
If month is less than 1, month subtracts the magnitude of that number of months, plus 1, from the first month in the year specified. For example, DATE(2008,-3,2) returns the serial number representing September 2, 2007.
Day Required. A positive or negative integer representing the day of the month from 1 to 31.
If day is greater than the number of days in the month specified, day adds that number of days to the first day in the month. For example, DATE(2008,1,35) returns the serial number representing February 4, 2008.
If day is less than 1, day subtracts the magnitude that number of days, plus one, from the first day of the month specified. For example, DATE(2008,1,-15) returns the serial number representing December 16, 2007.
Note: Excel stores dates as sequential serial numbers so that they can be used in calculations. January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,447 days after January 1, 1900. You will need to change the number format (Format Cells) in order to display a proper date.
For example: =DATE(C2,A2,B2) combines the year from cell C2, the month from cell A2, and the day from cell B2 and puts them into one cell as a date. The example below shows the final result in cell D2.
Need to insert dates without a formula? No problem. You can insert the current date and time in a cell, or you can insert a date that gets updated. You can also fill data automatically in worksheet cells.
Right-click the cell(s) you want to change. On a Mac, Ctrl-click the cells.
On the Home tab click Format > Format Cells or press Ctrl+1 (Command+1 on a Mac).
3. Choose the Locale (location) and Date format you want.
For more information on formatting dates, see Format a date the way you want.
You can use the DATE function to create a date that is based on another cell’s date. For example, you can use the YEAR, MONTH, and DAY functions to create an anniversary date that’s based on another cell. Let’s say an employee’s first day at work is 10/1/2016; the DATE function can be used to establish his fifth year anniversary date:
The DATE function creates a date.
The YEAR function looks at cell C2 and extracts «2012».
Then, «+5» adds 5 years, and establishes «2017» as the anniversary year in cell D2.
The MONTH function extracts the «3» from C2. This establishes «3» as the month in cell D2.
The DAY function extracts «14» from C2. This establishes «14» as the day in cell D2.
If you open a file that came from another program, Excel will try to recognize dates within the data. But sometimes the dates aren’t recognizable. This is may be because the numbers don’t resemble a typical date, or because the data is formatted as text. If this is the case, you can use the DATE function to convert the information into dates. For example, in the following illustration, cell C2 contains a date that is in the format: YYYYMMDD. It is also formatted as text. To convert it into a date, the DATE function was used in conjunction with the LEFT, MID, and RIGHT functions.
The DATE function creates a date.
The LEFT function looks at cell C2 and takes the first 4 characters from the left. This establishes “2014” as the year of the converted date in cell D2.
The MID function looks at cell C2. It starts at the 5th character, and then takes 2 characters to the right. This establishes “03” as the month of the converted date in cell D2. Because the formatting of D2 set to Date, the “0” isn’t included in the final result.
The RIGHT function looks at cell C2 and takes the first 2 characters starting from the very right and moving left. This establishes “14” as the day of the date in D2.
To increase or decrease a date by a certain number of days, simply add or subtract the number of days to the value or cell reference containing the date.
In the example below, cell A5 contains the date that we want to increase and decrease by 7 days (the value in C5).
Источник
How to Work With Date and Time Formulas in Excel
If you use Excel regularly, I’m sure you’ve come across dates and times in your cells. Data often has a record of when it was created or updated, so knowing how to work with this data is essential.
Here are three key skills that you’ll learn in this tutorial:
- How to format dates in Excel so that they appear in your preferred style
- Formulas to calculate the number of days, months, and years between two dates
- An Excel date formula to log today’s date, and a keyboard shortcut to add the current time
Microsoft Excel can basically do anything with data, if you just know how. This tutorial is another key step to adding skills to your Excel toolbelt. Let’s get started.
Excel Date and Time Formulas (Quick Video Tutorial)
This screencast will walk you through how to work with dates and times in Excel. I cover formatting dates to different styles, as well as Excel date formulas to calculate and work with dates. Make sure to download the free Excel workbook with exercises that I’ve attached to this tutorial.
Keep reading for a written reference guide on how to format dates and times in Excel, and work with them in your formulas. I’ll even share several tips that weren’t covered in the screencast.
Typing Dates and Times in Excel
For this part of the tutorial, use the tab titled «Typing Dates & Times» in the example workbook.
One of the keys to working with dates and times in Excel is capturing the data correctly. Here’s how to type dates and times in your Excel spreadsheets:
1. How to Type Dates
I recommend typing dates in the same format that your system uses. For our American readers, a full date would be in the «day/month/year» format. European style dates are «month/day/year.»
When I’m typing dates, I always type in the full date with the month, day and year. If I only want to show the month and the year, I’ll simply format it that way (more on that in a minute.)
2. How to Type Times
It’s easy to type times in Excel. We can specify anything from just an hour of the day, to the exact second that something took place.
If I wanted to log the time as 4PM, I’d type «4 pm» into a cell in Excel and then press enter:
Notice once we press enter, Excel converts what we’ve typed into a hours : minutes: seconds data format.
Here’s how to log a more specific time in your spreadsheet:
The key is to use colons to separate the section of the time data, and then add a space plus «AM» or «PM.»
3. How to Type Date-Time Together
You can also type combinations of dates and times in Excel for highly specific timestamps.
To type a date-time combination, simply use what we’ve already learned about typing dates, and typing times.
Notice that Excel has converted the time to a 24 hour format when it’s used in conjunction with a date, by default. If you want to change the style of this date, keep reading.
Bonus: Excel Keyboard Shortcut for Current Time
One of my favorite Excel keyboard shortcuts inserts the current time into a spreadsheet. I use this formula often, when I’m noting the time I made a change to my data. Try it out:
Formatting Dates in Excel
For this part of the tutorial, use the tab titled «Formatting Dates & Times» in the example workbook.
What can you do when your dates are European style dates? That is, they’re in a day-month-year format, and you need to convert them to the more familiar month-day-year format?
All of these cells contain exactly the same data, they’re just formatted in different ways.
In the screenshot above, what might surprise you is that all six of those cells contain exactly the same data — «1/22/2017.» What differs is how they’re formatted in Excel. The original data is identical, but it can be formatted to show in a variety of ways.
In most cases, it’s better to use formatting to modify the style of our dates. We don’t need to modify the data itself — just change how it’s presented.
Format Excel Cells
To change the appearance of our date and time data, make sure that you’re working on the Home tab of Excel. On the Ribbon (menu at the top of Excel), find the section labeled Number.
There’s a small arrow in the lower right corner of the section. Click it to open the Format Cells menu.
To format cells in Excel with built in styles, make sure you’re working on the Home tab and click the dropdown arrow next to the word «Number» in this screenshot.
The Format Cells menu has a variety of options for styling your dates and times. You could turn «1/22/2017» into «Sunday, January 22nd» with just formatting. Then, you could grab the format painter and change all of your cell styles.
The Format Cells menu allows you to change the styles of your dates and times without the work of changing the original date.
Spend some time exploring this menu and trying out the different styles for your Excel dates and times.
Get Data From Dates and Times
Let’s say that we have a list of data that has very specific dates and times, and we want to get simpler versions of those formulas. Maybe we have a list of exact transaction dates, but we want to work with them at a higher level, grouping them by year or month.
You can get the year from a date with this Excel formula:
To get just the month from a date cell, use the following Excel formula:
Find the Difference Between Dates and Times
For this part of the tutorial, use the tab titled «DATEDIF» in the example workbook.
While formats are used to change how dates and times are presented, formulas in Excel are used to modify, calculate, or work with dates and times programatically.
The DATEDIF formula is powerful for calculating differences between days. Give the formula two dates and and it will return the number of days, months, and years between two dates. Let’s look at how to use it.
1. Days Between Dates
This Excel date formula will calculate the number of days between two dates:
The formula takes two cells, separated by commas, and then uses a «d» to calculate the difference in days.
The DATEDIF formula takes two date cells and calculates the days between them.
Here are some ideas for how you could use this Excel date formula to your advantage:
- Calculate the difference between today and your birthday to start a birthday countdown
- Use a DATEDIF to calculate the difference between two dates and divide your stock portfolio’s growth by the number of days to calculate the growth (or loss!) per day
2. Months Between Dates
DATEDIF also calculates the number of months between two dates. This date formula in Excel is very similar, but substitutes an «m» for «d» to calculate the difference in months:
However, there’s a quirk in the way Excel applies DATEDIF: it calculates whole months between dates. See the screenshot below.
To me, there are three months between January 1st and March 31st (all of January, all of February, and almost all of March.) However, because Excel uses whole months, it only considers January and February as completed, whole months, so the result is «2.»
Here’s my preferred way to calculate the number of months between two dates. We’ll find the date difference in days, and then divide it by the average number of days in a month — 30.42 .
Let’s apply our modified DATEDIF to two dates:
Much better. The output of 2.99 is very close to 3 full months, and this will be much more useful in future formulas.
The official Excel documentation has a complex method to calculate months between dates, but this is a simple and easy way to get it pretty close. Writing a good Excel formula is about finding the sweet spot of precision and simplicity, and this formula does both.
3. Years Between Dates
Finally, let’s calculate the number of years between two dates. The official way to calculate years between dates is with the following formula:
Notice that this is the same as our past DATEDIF formulas, but we’ve simply substituted the last part of the formula with «y» to calculate the number of years between two dates. Let’s see it in action:
Notice that this works like the DATEDIF for months: it counts only full years that have passed. I’d rather include partial years passing as well. Here’s a better DATEDIF for years:
Basically, we’re just getting the date difference in days, and then dividing it by 365 to calculate it as a year. Here’s the results:
DATEDIF is extremely powerful, but watch out for how it works: it’s going to only calculate full months or years that have passed by default. Use my modified versions for more precision in the results.
Bonus: Work Days Between Dates
The Excel date formulas covered above focus on the number of business days between dates. However, it’s sometimes helpful to just calculate the number of workdays (basically weekdays) between two dates.
In this case, we’ll use =NETWORKDAYS to calculate the number of workdays between two dates.
In the screenshot below, I show an example of using NETWORKDAYS. You can see the calendar showing how the formula calculated a result of «4.»
If you have known holidays in the timeframe that you want to exclude, check out the official NETWORKDAYS documentation.
Recap and Keep Learning
Dates and times are ubiquitous to spreadsheets. Excel date formulas and formatting options are helpful. The techniques in this tutorial can take your Excel skills to the next level so that you can incorporate date-driven data seamlessly into your spreadsheets.
You’ve added one skill to your Excel toolbox — why stop here? Chain Excel formulas and skills to create powerful spreadsheets. To keep learning more about working with Excel spreadsheets, check out these other resources:
- IF Statements are logic built into your spreadsheet that show results based on conditions. You could combine an IF Statement with a date range to show data based on a date or time. Check out this tutorial to learn them.
- You could combine the VLOOKUP tutorial with date and time formulas to match values based on a date or time.
- Find and Remove Duplicates is an Excel function used in combination with date and time data, as it’s often one of the best bits of data to check for duplicates.
How do you work with calendar and time data in your Excel spreadsheets? Are there are any Excel date or time formulas that I’m missing from this tutorial that you use regularly? If so, let me know in the comments.
Источник
There are many functions in Microsoft Excel that may be used to work with dates and timings in Excel. Each function completes a straightforward task, but by combining numerous functions into a single formula, you may handle trickier and more complicated problems. The purpose of discussing DATE functions in Excel is to help different people to perform more complex and challenging tasks by combining several functions within one formula.
The DATE function is used to calculate dates in Excel. Excel provides different functions to work with dates & times such as TODAY, NOW, WEEKDAY, EOMONTH, etc. which we will discuss here with examples.
1. DATE Function in Excel
It will return the date in serial number based on the year, month, or day value as provided.
Syntax:
DATE(year,month,day)
Arguments:
- Year – This argument includes – 1 to 4-digit values. Excel understands this ‘year’ argument according to the date system of the local computer which we use. For example- Excel windows uses the 1900 date system by default which means DATE (21,2,6) gives the result as 06-02-1921.
- Month – This argument includes a positive or negative integer that represents the month of the year from January to December.
- Day – This argument also includes a positive or negative integer representing the day of the month from 1 to 31.
Excel Date Function Example 1:
Excel Date Function Example 2:
It will return on the first day of the current year & month.
Excel Date Function Example 3:
2. TODAY Function in Excel
The TODAY() function name suggests it will return today’s date, and it has no arguments.
Syntax:
TODAY()
Example1:
Here we will print the current date and also add 10 days to the current date.
Example 2:
To add 10 days to Today’s date.
3. NOW Function in Excel
This function returns the current date as well as the time & doesn’t have any arguments.
Syntax:
NOW()
Example:
4. DATEVALUE Function
It converts the date in text format to a serial number, which can be represented as a date.
Syntax:
DATEVALUE(date_text)
Arguments:
1. date_text – This argument is a text that represents the date in Excel date format.
Example:
5. TEXT Function
It converts any numeric value not only dates to a text string. Through this function, we can change the date to text strings in a variety of formats.
Syntax:
TEXT(value,format_text)
Arguments:
1. value: The value that is to be converted.
2. format_text: The format in which you want to output the date value.
These are the different formats used in the TEXT function to change dates to text strings.
Example 1:
Example 2:
Example 3:
6. DAY Function
It returns the day of a month, i.e. integer from 1 to 31.
Syntax:
DAY(serial_number)
Arguments:
1. serial_number: This value represents the day of the month you want to find. E.g: 5th day of June
Example 1:
Example 2:
The DAY(TODAY()) function returns the day of today’s date, as shown below:
7. MONTH Function
This function returns the month of the given date as an integer from 1 to 12 (January to December).
Syntax:
MONTH(serial_number)
Arguments:
1. serial_number: This value represents the date for which you want to find the month.
Example:
The MONTH(TODAY()) function returns the month of today’s date.
8. YEAR Function
It returns the year of a specified date.
Syntax:
YEAR(serial_number)
Arguments:
1. serial_number: The date to be specified.
Example 1:
Example 2:
Example 3:
9. EOMONTH Function
This function returns the last day of the month after adding a specified number of months to a given date.
Syntax:
EOMONTH(start_date,months)
Arguments:
1. start_date: In this argument, the date should be written in date format, not in the text.
2. months: In this argument, if a positive integer is given then corresponding months can be added to the start date & if a negative integer is given then the corresponding months can be subtracted from the start date.
Example 1:
Example 2:
Example 3:
The EOMONTH(TODAY(),0) function returns the last day of the current month.
10. WEEKDAY Function
This function returns the day of the week as a number from 1 to 7 (Sunday to Saturday) according to the specified date.
Syntax:
WEEKDAY(serial_number,return_type)
Arguments:
1. serial_number: It can be a date or the cell that contains the date.
2. return_type: It is optional, as it specifies which day should be considered as the first day of the week.
NOTE: 1st day of the week is by default Sunday.
Example 1:
Example 2:
In the below example, 2 is given as return_type i.e. Monday is referred to as the first day of the week.
Example 3:
Here the day of today’s (01-04-2021) date is the result & the default value (Sunday) is considered here because no return_type is given.
11. DATEDIF Function
This function calculates the difference between two dates in days, months, or years. For calculating the difference b/w dates which time interval should be used depends on the letter which we specify in our last argument i.e. at the unit.
Syntax:
DATEDIF(start_date,end_date,unit)
Arguments:
1. start_date: The start date for evaluating the difference.
2. end_date: The end Date for evaluating the difference.
Example 1:
Example 2:
Example 3:
Here “m”,”y”,”d” means month, year & date. In the first example, the difference between dates is calculated by months, second by year & third by date.
12. WEEKNUM Function
It returns the week number based on the specified date, i.e. from 1 to 52 weeks of the year.
Syntax:
WEEKNUM(serial_number,firstday_ofweek)
Arguments:
1. serial_number: This is the date for which we want the week number.
2. firstday_ofweek: This is an optional argument that specifies which numbering system should be considered & which day of the week can be treated as the start of the week, Default(omitted) is 1. The table below is the parameters that can be given in firstday_ofweek argument.
First Day of the Week Start Table:
1 | Sunday | 1 |
2 | Monday | 1 |
11 | Monday | 1 |
12 | Tuesday | 1 |
13 | Wednesday | 1 |
14 | Thursday | 1 |
15 | Friday | 1 |
16 | Saturday | 1 |
17 | Sunday | 1 |
21 | Monday | 2 |
Example 1:
Example 2:
Example 3:
In the below example,21 is given as the second argument which means Monday is taken as the first day of the week & in the above example, the result shown is 15 but taking 21 as the first_dayofweek means Monday is the first day, the result is 14.
13. EDATE Function
This function adds or subtracts the specified month to a given date.
Syntax:
EDATE(start_date,months)
Arguments:
1. start_date: This is an initial date on which the months are added or subtracted.
2. months: This is the number of months which is to be added or subtracted in the specified date.
Example 1:
Example 2:
Example 3:
14. YEARFRAC Function
This function returns the fraction of the year which represents the number of whole days between the start & end date.
Syntax:
YEARFRAC(start_date,end_date,[basis])
Arguments:
1. start_date: This is the start date in the serial number.
2. end_date: This is the end date in the serial number.
3. basis: This is the optional argument that specifies the day count method.
Basis | Day count method |
---|---|
0(default) | US 30/360 |
1 | actual/actual |
2 | actual/360 |
3 | actual/365 |
4 | European 30/360 |
Example 1:
Using someday count methods.
Example 2:
Example 3:
15. WORKDAY Function
This function helps if we exactly know how many working days we have & want to find out the date when the number of working will skip. This function always includes working days & excludes weekend days.
Syntax:
WORKDAY(start_date,days,holidays)
Arguments:
1. start_date: This argument is the date from which the counting of weekdays begins. Excel doesn’t include start_date as a working day.
2. days: This is the number of working days.
3. holidays: This is an optional argument. If the days mentioned include any holidays, then we need to make a list of holidays separately for this, and mention it here.
Example 1:
28 workdays from the start date, excluding holidays.
Example 2:
28 workdays before the start date, excluding holidays
Example 3:
28 workdays from the start date, no holidays.
Example 4:
28 workdays from today’s date, no holidays.
16. WORKDAY.INTL Function
This is a modification of the WORKDAY function as it provides a custom weekend parameter that distinguishes this from the WORKDAY function.
Syntax:
WORKDAY.INTL(start_date,days,[weekends],holidays)
Arguments:
1. start_date: This argument is the date from which the counting of weekdays begins. Excel doesn’t include start_date as a working day.
2. days: This is the number of working days.
3. holidays: This is an optional argument. If the days mentioned include any holidays, then we need to make a list of holidays separately for this and mention it here.
4. weekends: Through this argument, we can specify which days of the week to be treated as non-working days, either by weekend number or specific character string.
Weekend Number:
Numbers | Days |
---|---|
1 (default) | Saturday, Sunday |
2 | Sunday, Monday |
3 | Monday, Tuesday |
4 | Tuesday, Wednesday |
5 | Wednesday, Thursday |
6 | Thursday, Friday |
7 | Friday, Saturday |
11 | Sunday |
12 | Monday |
13 | Tuesday |
14 | Wednesday |
15 | Thursday |
16 | Friday |
17 | Saturday |
If this weekend argument is blank in this function, then it will automatically take the combination of Saturday & Sunday.
For instance:
- “0000011”-Saturday & Sunday are weekends(non-working days)
- “1000010”-Monday & Saturday are weekends(non-working days)
Example 1:
30 days from the start date, excluding holidays & Sunday, and Monday as weekends (by giving weekend number 2 as arguments).
Example 2:
30 days from the start date, excluding holidays & Sunday, Monday as weekends(by giving weekend string “1000001” as arguments).
Example 3:
20 days from the start date, no holidays & Monday, Saturday as weekends (by giving weekend string “1000010” as arguments).
17. NETWORKDAYS Function
This function returns the number of working days between two dates, excluding weekends & holidays are as optional arguments.
Syntax:
NETWORKDAYS(start_date,end_date,holidays)
Arguments:
1. start_date: The initial date to start evaluation.
2. end_date: The last date to end the evaluation.
4. holidays: Used to specify holidays.
Example 1:
Example 2:
18. NETWORKDAYS.INTL Function
This function also returns the number of working days between two dates but provides the additional argument weekend to specify which days should be counted as weekend days.
The structure of the weekend argument is the same as for WORKDAY.INTL i.e. we can use either the weekend number or character string.
Syntax:
NETWORKDAYS.INTL(start_date,end_date,[weekend],holidays)
Arguments:
1. start_date: The initial date to start the evaluation.
2. end_date: The last date to end the evaluation.
3. weekend: Use to specify the weekends.
4. holidays: Used to specify holidays.
Example 1:
Here, the weekend argument is given in the form of a number.
Example 2:
Here, the weekend argument is given in the form of a character string of 0’s & 1’s.
Hopefully, this extensive overview of Excel’s date functions has given you a general idea of how date formulas in Excel operate. I advise you to read more articles on Excel if you want to understand more. I appreciate your time and look forward to hearing from you soon!
FAQs on DATE Functions in Excel
Here are some of the most frequently asked questions on DATE Functions in Excel
1. What is a Date function?
The DATE function in Excel combines the three independent values of year, month, and day to create a date.
Syntax: DATE(year,month,day)
2. How do I get DD MMM YYYY in Excel?
- Pick the cell that contain the date>right-click and select Format Cells
- Select Custom in the Number Tab>type ‘dd-mmm-yyyy’ in the Type text box>click OK.
Содержание
- Работа с функциями даты и времени
- ДАТА
- РАЗНДАТ
- ТДАТА
- СЕГОДНЯ
- ВРЕМЯ
- ДАТАЗНАЧ
- ДЕНЬНЕД
- НОМНЕДЕЛИ
- ДОЛЯГОДА
- Вопросы и ответы
Одной из самых востребованных групп операторов при работе с таблицами Excel являются функции даты и времени. Именно с их помощью можно проводить различные манипуляции с временными данными. Дата и время зачастую проставляется при оформлении различных журналов событий в Экселе. Проводить обработку таких данных – это главная задача вышеуказанных операторов. Давайте разберемся, где можно найти эту группу функций в интерфейсе программы, и как работать с самыми востребованными формулами данного блока.
Работа с функциями даты и времени
Группа функций даты и времени отвечает за обработку данных, представленных в формате даты или времени. В настоящее время в Excel насчитывается более 20 операторов, которые входят в данный блок формул. С выходом новых версий Excel их численность постоянно увеличивается.
Любую функцию можно ввести вручную, если знать её синтаксис, но для большинства пользователей, особенно неопытных или с уровнем знаний не выше среднего, намного проще вводить команды через графическую оболочку, представленную Мастером функций с последующим перемещением в окно аргументов.
- Для введения формулы через Мастер функций выделите ячейку, где будет выводиться результат, а затем сделайте щелчок по кнопке «Вставить функцию». Расположена она слева от строки формул.
- После этого происходит активация Мастера функций. Делаем клик по полю «Категория».
- Из открывшегося списка выбираем пункт «Дата и время».
- После этого открывается перечень операторов данной группы. Чтобы перейти к конкретному из них, выделяем нужную функцию в списке и жмем на кнопку «OK». После выполнения перечисленных действий будет запущено окно аргументов.
Кроме того, Мастер функций можно активировать, выделив ячейку на листе и нажав комбинацию клавиш Shift+F3. Существует ещё возможность перехода во вкладку «Формулы», где на ленте в группе настроек инструментов «Библиотека функций» следует щелкнуть по кнопке «Вставить функцию».
Имеется возможность перемещения к окну аргументов конкретной формулы из группы «Дата и время» без активации главного окна Мастера функций. Для этого выполняем перемещение во вкладку «Формулы». Щёлкаем по кнопке «Дата и время». Она размещена на ленте в группе инструментов «Библиотека функций». Активируется список доступных операторов в данной категории. Выбираем тот, который нужен для выполнения поставленной задачи. После этого происходит перемещение в окно аргументов.
Урок: Мастер функций в Excel
ДАТА
Одной из самых простых, но вместе с тем востребованных функций данной группы является оператор ДАТА. Он выводит заданную дату в числовом виде в ячейку, где размещается сама формула.
Его аргументами являются «Год», «Месяц» и «День». Особенностью обработки данных является то, что функция работает только с временным отрезком не ранее 1900 года. Поэтому, если в качестве аргумента в поле «Год» задать, например, 1898 год, то оператор выведет в ячейку некорректное значение. Естественно, что в качестве аргументов «Месяц» и «День» выступают числа соответственно от 1 до 12 и от 1 до 31. В качестве аргументов могут выступать и ссылки на ячейки, где содержатся соответствующие данные.
Для ручного ввода формулы используется следующий синтаксис:
=ДАТА(Год;Месяц;День)
Близки к этой функции по значению операторы ГОД, МЕСЯЦ и ДЕНЬ. Они выводят в ячейку значение соответствующее своему названию и имеют единственный одноименный аргумент.
РАЗНДАТ
Своего рода уникальной функцией является оператор РАЗНДАТ. Он вычисляет разность между двумя датами. Его особенность состоит в том, что этого оператора нет в перечне формул Мастера функций, а значит, его значения всегда приходится вводить не через графический интерфейс, а вручную, придерживаясь следующего синтаксиса:
=РАЗНДАТ(нач_дата;кон_дата;единица)
Из контекста понятно, что в качестве аргументов «Начальная дата» и «Конечная дата» выступают даты, разницу между которыми нужно вычислить. А вот в качестве аргумента «Единица» выступает конкретная единица измерения этой разности:
- Год (y);
- Месяц (m);
- День (d);
- Разница в месяцах (YM);
- Разница в днях без учета годов (YD);
- Разница в днях без учета месяцев и годов (MD).
Урок: Количество дней между датами в Excel
ЧИСТРАБДНИ
В отличии от предыдущего оператора, формула ЧИСТРАБДНИ представлена в списке Мастера функций. Её задачей является подсчет количества рабочих дней между двумя датами, которые заданы как аргументы. Кроме того, имеется ещё один аргумент – «Праздники». Этот аргумент является необязательным. Он указывает количество праздничных дней за исследуемый период. Эти дни также вычитаются из общего расчета. Формула рассчитывает количество всех дней между двумя датами, кроме субботы, воскресенья и тех дней, которые указаны пользователем как праздничные. В качестве аргументов могут выступать, как непосредственно даты, так и ссылки на ячейки, в которых они содержатся.
Синтаксис выглядит таким образом:
=ЧИСТРАБДНИ(нач_дата;кон_дата;[праздники])
ТДАТА
Оператор ТДАТА интересен тем, что не имеет аргументов. Он в ячейку выводит текущую дату и время, установленные на компьютере. Нужно отметить, что это значение не будет обновляться автоматически. Оно останется фиксированным на момент создания функции до момента её перерасчета. Для перерасчета достаточно выделить ячейку, содержащую функцию, установить курсор в строке формул и кликнуть по кнопке Enter на клавиатуре. Кроме того, периодический пересчет документа можно включить в его настройках. Синтаксис ТДАТА такой:
=ТДАТА()
СЕГОДНЯ
Очень похож на предыдущую функцию по своим возможностям оператор СЕГОДНЯ. Он также не имеет аргументов. Но в ячейку выводит не снимок даты и времени, а только одну текущую дату. Синтаксис тоже очень простой:
=СЕГОДНЯ()
Эта функция, так же, как и предыдущая, для актуализации требует пересчета. Перерасчет выполняется точно таким же образом.
ВРЕМЯ
Основной задачей функции ВРЕМЯ является вывод в заданную ячейку указанного посредством аргументов времени. Аргументами этой функции являются часы, минуты и секунды. Они могут быть заданы, как в виде числовых значений, так и в виде ссылок, указывающих на ячейки, в которых хранятся эти значения. Эта функция очень похожа на оператор ДАТА, только в отличии от него выводит заданные показатели времени. Величина аргумента «Часы» может задаваться в диапазоне от 0 до 23, а аргументов минуты и секунды – от 0 до 59. Синтаксис такой:
=ВРЕМЯ(Часы;Минуты;Секунды)
Кроме того, близкими к этому оператору можно назвать отдельные функции ЧАС, МИНУТЫ и СЕКУНДЫ. Они выводят на экран величину соответствующего названию показателя времени, который задается единственным одноименным аргументом.
ДАТАЗНАЧ
Функция ДАТАЗНАЧ очень специфическая. Она предназначена не для людей, а для программы. Её задачей является преобразование записи даты в обычном виде в единое числовое выражение, доступное для вычислений в Excel. Единственным аргументом данной функции выступает дата как текст. Причем, как и в случае с аргументом ДАТА, корректно обрабатываются только значения после 1900 года. Синтаксис имеет такой вид:
=ДАТАЗНАЧ (дата_как_текст)
ДЕНЬНЕД
Задача оператора ДЕНЬНЕД – выводить в указанную ячейку значение дня недели для заданной даты. Но формула выводит не текстовое название дня, а его порядковый номер. Причем точка отсчета первого дня недели задается в поле «Тип». Так, если задать в этом поле значение «1», то первым днем недели будет считаться воскресенье, если «2» — понедельник и т.д. Но это не обязательный аргумент, в случае, если поле не заполнено, то считается, что отсчет идет от воскресенья. Вторым аргументом является собственно дата в числовом формате, порядковый номер дня которой нужно установить. Синтаксис выглядит так:
=ДЕНЬНЕД(Дата_в_числовом_формате;[Тип])
НОМНЕДЕЛИ
Предназначением оператора НОМНЕДЕЛИ является указание в заданной ячейке номера недели по вводной дате. Аргументами является собственно дата и тип возвращаемого значения. Если с первым аргументом все понятно, то второй требует дополнительного пояснения. Дело в том, что во многих странах Европы по стандартам ISO 8601 первой неделей года считается та неделя, на которую приходится первый четверг. Если вы хотите применить данную систему отсчета, то в поле типа нужно поставить цифру «2». Если же вам более по душе привычная система отсчета, где первой неделей года считается та, на которую приходится 1 января, то нужно поставить цифру «1» либо оставить поле незаполненным. Синтаксис у функции такой:
=НОМНЕДЕЛИ(дата;[тип])
ДОЛЯГОДА
Оператор ДОЛЯГОДА производит долевой расчет отрезка года, заключенного между двумя датами ко всему году. Аргументами данной функции являются эти две даты, являющиеся границами периода. Кроме того, у данной функции имеется необязательный аргумент «Базис». В нем указывается способ вычисления дня. По умолчанию, если никакое значение не задано, берется американский способ расчета. В большинстве случаев он как раз и подходит, так что чаще всего этот аргумент заполнять вообще не нужно. Синтаксис принимает такой вид:
=ДОЛЯГОДА(нач_дата;кон_дата;[базис])
Мы прошлись только по основным операторам, составляющим группу функций «Дата и время» в Экселе. Кроме того, существует ещё более десятка других операторов этой же группы. Как видим, даже описанные нами функции способны в значительной мере облегчить пользователям работу со значениями таких форматов, как дата и время. Данные элементы позволяют автоматизировать некоторые расчеты. Например, по введению текущей даты или времени в указанную ячейку. Без овладения управлением данными функциями нельзя говорить о хорошем знании программы Excel.
You can use dates and time in your formulas just like any other value. For example, if cell A1 contained the entry 5/1/19 you could use the formula =A1+100 to calculate the date 100 days later, which is 8/9/19.
One very important thing to know about working with date and time functions: while Excel can display dates and times using just about any format, it stores dates as chronological numbers called serial values. So, when you think of dates as months, days, and years, such as May 1, 2019, Excel thinks of dates in terms of serial numbers, such as 36281.
Since the date and time formulas often return serial number values, you should format any cells with date or time formulas with date and time formats that you can easily understand.
Common Date Functions
This table lists some of the date and time functions available in Excel.
Function Name |
Function |
What the Function Does |
---|---|---|
Date |
=DATE(year, month, day) |
Enters a date in the cell. Example: DATE(2019,5,1) equals May 1, 2019. |
Today |
=TODAY( ) | A special version of the DATE function. The DATE function returns the value of any date; the TODAY function returns the value of the current date. |
Time |
=TIME(hour, minute, second) |
Enters a time in the cell. Uses a 24-hour (military) time system. Example: TIME(14,30,0) equals 2:30 PM. |
Now |
=NOW( ) | A special version of the TIME function. The TIME function returns the value of any time; the NOW function returns the value of the current time. |
Year |
=YEAR(serial_number, return_type) |
Returns a value of the year for a specific date. The serial_number argument is a date value (or reference to one). Example: YEAR(«3/15/2019») equals 2019. |
Month |
=MONTH(serial_number, return_type) |
Returns a value of the month for a specific date. The serial_number argument is a date value (or reference to one). Example: MONTH(«3/15/2019») equals 3. |
Day |
=DAY(serial_number, return_type) |
Returns a value of the day for a specific date. The serial_number argument is a date value (or reference to one). Example: DAY(«3/15/2019») equals 15. |
TODAY() Function
If you need to calculate values based on dates, a very helpful function is TODAY, which returns today’s date.
- Select the cell where you want to add the TODAY() function.
- Click the Formulas tab on the ribbon.
- Click the Date & Time button.
- Select Today.
- Click OK.
You can also insert the function by typing =TODAY() in the cell.
Excel adds today’s date.
Date Calculations in Formulas
Referencing cells with a date calculation in a formula is often no different than referencing cells with numbers—you can include date values in basic formulas.
- Select the cell where you want to calculate a date formula.
- Press = and enter the formula, referencing the cells that contain a date formula.
- Click the Enter button.
FREE Quick Reference
Click to Download
Free to distribute with our compliments; we hope you will consider our paid training.