Excel date this month

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

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.

Syntax: DATE(year,month,day)

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.

DATE function example 1

Syntax: DATE(year,month,day)

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.

DATE function Example 2

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.

  1. Right-click the cell(s) you want to change. On a Mac, Ctrl-click the cells.

  2. On the Home tab click Format > Format Cells or press Ctrl+1 (Command+1 on a Mac).

  3. 3. Choose the Locale (location) and Date format you want.

  4. For more information on formatting dates, see Format a date the way you want.

    Format a cell as a date

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:

Calculate a date based on another date

  1. The DATE function creates a date.

    =DATE(YEAR(C2)+5,MONTH(C2),DAY(C2))

  2. The YEAR function looks at cell C2 and extracts «2012».

  3. Then, «+5» adds 5 years, and establishes «2017» as the anniversary year in cell D2.

  4. The MONTH function extracts the «3» from C2. This establishes «3» as the month in cell D2.

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

Convert text strings and numbers into dates

  1. The DATE function creates a date.

    =DATE(LEFT(C2,4),MID(C2,5,2),RIGHT(C2,2))

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

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

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

Increase or decrease a date by a certain number of days

See Also

Add or subtract dates

Insert the current date and time in a cell

Fill data automatically in worksheet cells

YEAR function

MONTH function

DAY function

TODAY function

DATEVALUE function

Date and time functions (reference)

All Excel functions (by category)

All Excel functions (alphabetical)

Need more help?

Excel allows you to format dates in many different ways. You can choose to show the date in a short date format or in a long date format.

You can also only show the day number, the month name, or the year from a given date.

In this short Excel tutorial, I will show you some easy methods to get the month name from a date in Excel.

So, let’s get started!

Getting the Month Name from the Date

There are multiple different ways to get monthly from a date in Excel.

The method you choose would depend on how you want the result (i.e., whether you want it as a text string or have the entire date but only show the name of the month)

Let’s see a couple of methods to do this that you can use in different scenarios.

Custom Formatting

Using custom number formatting to get the month name is the best method out of all those covered in this tutorial.

This is because it does not change the underlying date. It only changes the way the date is being displayed in the cell – which is by showing only the month name from the date.

The benefit of using this method is that you can still use the date in calculations.

Suppose you have the dates as shown below and you want to only display the month name and not the entire date.

Date Dataset

Below are the steps to do this:

  1. Select all the cells that have the dates for which you want to show the month name
  2. Click the Home tabClick the Home tab
  3. In the Number group, click on the dialog box launcher icon (or you can use the keyboard shortcut Control +1). This will open the Format Cells dialog boxClick on Format Cells open dialog box launcher
  4. In the Category options, click on CustomClick on Custom option in Fomat Cells dialog box
  5. In the type field, enter – ‘mmmm’. you should see one of the month names in the Sample preview.Enter mmmm as the custom number format
  6. Click OK

The above steps would convert all the dates into their respective full month names (as shown below).

Date showing only the month name

As I mentioned, the good thing about this method is that even though you are seeing the month names in the cell, the underlying value is still a date (which means that the underlying value is still a number that represents the date).

So, if you want to use these dates in calculations, you can easily do that.

You can also use custom number formatting to show the month name or the month value in different ways. To do this, you will have to give custom number formatting the right code to display the month name.

Below are the different month codes that you can use:

  • m – this will show the month number. For example, a date in January would be shown as 1, a date in February would be shown as 2, and so on
  • mm – this will also show the month number, but it will also make sure that there are always two digits that are displayed. For example, a date in January would be shown as 01, a date in February would be shown as 02, and a date in November would be shown as 11
  • mmm – this will show the month name in a three-letter code. For example, a date in January would be shown as Jan, a date in August would be shown as Aug, and so on
  • mmmm – this is the option that we used in the above example, and it would show the complete month name
  • mmmmm – this option shows only the first alphabet of the month name. For example, January is shown as J and February is shown as F, and so on. I’ve never seen this being used because it’s confusing as January would also show J and July would also show J

TEXT Function

TEXT function allows us to convert a date into any permissible format that we want and gives the result as a text string.

For example, we can use the TEXT function to show the month name from a date.

Now if you’re wondering how is it different from the custom number formatting we used earlier, the big difference here is that with the TEXT function, you can combine the result with other functions or text strings.

Don’t worry if you are a little lost as of now, the next few examples will make it clear.

Suppose you have a dataset as shown below and you want to show the month name instead of the full date.

Date Dataset

Below is the TEXT formula will give you the month name:

=TEXT(A2,"mmmm")

TEXT formula to get Month Name

The above text formula takes the date as the input and applies the specified format to it (which is “mmmm” in this formula).

Unlike the Custom Number Formatting method, when you use the TEXT function, the result is a text value. This means that you cannot use the result as a date or number in calculations.

But a good thing about using the TEXT function is that you can combine the result of the function with other text strings.

Let me explain using an example.

Suppose you have the same data set and in this case, instead of just getting the month name, you want to get the month name followed by the quarter number (such as January – Quarter 1).

The below formula would do this for you:

=TEXT(A2,"mmmm")&" - Quarter "&ROUNDUP(MONTH(A2)/3,0)

TEXT formula to combine text and formula result

The above formula uses the ROUNDUP and the MONTH function to get the quarter number of the calendar year, and then it is combined with the month name which is given by the TEXT function.

Since the result of the TEXT function is a text string, I can combine it with other text strings or formula results.

CHOOSE Function

Another formula that you can use to quickly get the month name from the month number is using the CHOOSE formula.

While it ends up being a long formula, the choose formula technique is useful when you want to get the result which you cannot get with custom number formatting or the text function.

For example, if you want to return custom month names (such as month names in any other language or only five alphabets for each month name), you can do that using the CHOOSE formula.

Suppose you have a data set as shown below and you want to get the month name for each of these dates.

Date Dataset

Below is the formula that will do that:

=CHOOSE(MONTH(A2),"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

Choose formula to get Month name

CHOOSE formula takes an index number (which is given by the month formula in our example) and then uses that index number to decide what value to return.

In this example, I have kept the month names to standard three-letter names, but you can change this and use whatever name you want.

Also read: Get Days in Month in Excel

Using Power Query

I have started using Power Query a lot more in my work as I find it a lot easier to clean the data using it.

It has an inbuilt feature that allows you to quickly convert a date into the month name.

The real value of using Power Query in such a scenario would be when you’re importing the data from other Excel files (or consolidating data from multiple Excel files into one file), and while doing it you want to convert your dates into month names.

You can check out my Power Query course on YouTube if you want to learn more about it.

For this technique to work, your data needs to be in an Excel table. While you can still use Power Query with named ranges, if your data is not in an Excel table I recommend you use any of the above methods.

Suppose you have the below data and you want to convert these dates into month names.

Excel Table with Dates

Below are the steps to do this:

  1. Select any cell in the dataset
  2. Click the Data tabClick the Data tab
  3. In the Get & Transform Data tab, click on From Table/RangeClick on From Table Range
  4. In the Power Query editor that opens up, right-click on the Date column header
  5. Go to Transform >> Month >> Name of MonthClick on Name of the Month in Power Query
  6. Click on Close and LoadClick on Close and Load

The above steps would insert a new worksheet and give you the resulting table in that new sheet.

Result with Month Name from Power Query

Now, if you’re wondering why do all this when you can simply use custom number formatting or the text function, you need to understand the real value of Power Query trying to automate work.

If you need the month name from the date just once, feel free to use the methods shown above.

But if you’re using Power Query already to manage data from multiple different sources or combined files or sheets, then knowing that you can easily get the month name from the date can save you a lot of time.

So these are some of the methods that you can use to quickly get the month name from a date in Excel.

I hope you found this tutorial useful.

Other Excel tutorial’s you may also like:

  • Calculate the Number of Months Between Two Dates in Excel
  • Calculate Time in Excel (Time Difference, Hours Worked, Add/ Subtract)
  • How to Change Date Format In Excel?
  • How to Get the First Day of the Month in Excel
  • How to Add or Subtract Days to a Date in Excel (Shortcut + Formula)
  • How to Convert Serial Numbers to Dates in Excel)
  • How to Stop Excel from Changing Numbers to Dates Automatically
  • How to Make an Interactive Calendar in Excel? (FREE Template)

Whenever you enter a date in a cell, Excel automatically recognizes the format and converts the cell to a date cell.

So, Excel knows which part of the date you entered is the month, which is the year and which is the day.

This can be quite helpful in many ways. One particular benefit of this capability of Excel is that it lets you display the date in any format you want. It even lets you extract parts of the date that you need.

For example, you might find the day part of the date irrelevant and just need to display the month and year.

Since Excel already understands your date, you can easily extract just the month and year and display it in any format you like.

In this tutorial, we are going to see three ways in which you can convert date to month and year in Excel.

The Sample Data

Throughout this tutorial, we are going to be using the following set of dates. We will be converting these dates to month and year in Excel:

The sample data

When working with dates, first and foremost, it is important to recognize the original format your Excel dates are in. For example, in the US format, dates usually begin with the month and end with the year (mm/dd/yyyy).

In the UK and other countries, dates begin with the day and end with the year (dd/mm/yyyyy). In still other places like China, Iran, and Korea, the order is completely flipped (yyyy/mm/dd).

Depending on your computer’s date settings Excel will treat parts of your date differently. So when entering the date, make sure you check the format and enter the date in the correct order. You don’t want the date 2/10 to be treated as October, the 2nd instead of February, the 10th!

Convert Date to Month and Year using the MONTH and YEAR function

The MONTH and YEAR functions can help you extract just the month or year respectively from a date cell. In order for this method to work, the original date (on which you want to operate) must be a valid Excel date. If not, then both these functions will return a #VALUE error.

Let’s see how you can extract the month from our sample data:

  1. Click on a blank cell where you want the month to be displayed (B2)
  2. Type: =MONTH, followed by an opening bracket (.
  3. Click on the first cell containing the original date (A2).
  4. Add a closing bracket )
  5. Press the Return key.Getting the month number from the date using the MONTH function
  6. This should display the month of the year corresponding to the original date. Copy this to the rest of the cells in the column by dragging down the fill handle or double-clicking on it.

You will see column B populated by the month of the year for all the dates of column A.

MONTH function result

Now let’s see how you can extract the year from the same dataset:

  1. Click on a blank cell where you want the year to be displayed (C2)
  2. Type: =YEAR, followed by an opening bracket (.
  3. Click on the first cell containing the original date (A2).
  4. Add a closing bracket )
  5. Press the Return key.Getting the year number from the date using the YEAR function
  6. This should display the year corresponding to the original date. Copy this to the rest of the cells in the column by dragging down the fill handle or double-clicking on it.

You will see column C populated by the year corresponding to all the dates of column A.

Year function result

Now let’s see how you can combine the results of the two to display both month and year in a nice format.

Let us say you want to display both month and year as “2-2018” for the date “02/10/2018”, and want to follow this pattern for all the dates.

  1. Click on a blank cell where you want the new date format to be displayed (D2)
  2. Type the formula: =B2 & “-“ & C2. Alternatively, you can type: =MONTH(A2) & “-” & YEAR(A2).
  3. Press the Return key.Combine and create the date using ampersand
  4. This should display the original date in our required format. Copy this to the rest of the cells in the column by dragging down the fill handle or double-clicking on it.

Now all your cells in column D2 have the new format:

Month and year separated by dashonth and year separated by dash

Alternatively, if you want to display your month and year as 2/2018 instead, you only need to replace the “-“ in-between with a “/”. In this way, you can display the month and year in any format that you like.

Month and year separated by forward slash

Finally, if you want to just keep the converted values and want to remove the original dates and any intermediate columns that you created you need to first convert the formula results into constant values.

For this, copy the cells of column D and paste them as values in the same column (Right-click and select Paste Options->Values from the Popup menu). Now you can go ahead and delete columns A to C. You will be left with only the converted values that have the month and year.

Copy and paste dates as values

Although this is quite an easy and intuitive way to convert dates to months and years, it is a less popular method. This is because this method does not provide a lot of flexibility compared to the other two methods we will show next.

Also read: How to Calculate the Number of Months Between Two Dates in Excel?

Convert Date to Month and Year using the TEXT Function

The TEXT function in Excel converts any numeric value (like date, time, and currency) into text with a specified format.

The syntax of the TEXT function is:

= TEXT (value, format_code)

Here,

  • value is the numeric value or reference to the cell that you want to convert
  • format_code is the format you want to convert the cell into

In the above example, the TEXT function applies the format_code that you specified on the value and returns a text string with that format. For example, if you have a date “2/10/2018” in cell A2, then =TEXT(A2, “mm/yyyy”) will return “02/2018”

There are a number of format codes that you can use. We have enlisted below the basic building blocks for the format codes:

Format Codes for Year:

You can use the following two basic format codes to represent year values:

  • yy – two-digit representation of year (e.g. 20 or 12)
  •  yyyy – four-digit representation of year (e.g. 2020 or 2012)

So, if you apply =TEXT(A2, yy) in our example dataset, it will return “18”.

If you apply =TEXT(A2, yyyy), then it will return “2018”.

Format Codes for Month of the Year:

You can use the following four basic format codes to represent month values:

  • m – one or two-digit representation of the month (eg; 8 or 12)
  • mm – two-digit representation of the month (eg; 08 or 12)
  • mmm – month abbreviated in three letters (eg: Aug or Dec)
  • mmmm – month expressed with the full name (eg: August or December)

So, if you apply =TEXT(A2, m) in our example dataset, it will return “2”.

  • If you apply =TEXT(A2, mm), then it will return “02”.
  • If you apply =TEXT(A2, mmm), then it will return “Feb”.
  • If you apply =TEXT(A2, mmmm), then it will return “February”.

Let us see how we can apply the TEXT function to our sample dataset to convert all the dates to different formats.

We will first see how to convert the dates in column A to the format shown in column B in the image below:

Converting dates using the TEXT formula

Below are the steps to change the date format and only get month and year using the TEXT function:

  1. Click on a blank cell where you want the new date format to be displayed (B2)
  2. Type the formula:
    =TEXT(A2,”m/yy”)
  3. Press the Return key.
  4. This should display the original date in our required format. Copy this to the rest of the cells in the column by dragging down the fill handle or double-clicking on it.TEXT formula
  5. Copy this column’s formula results by pressing CTRL+C or Cmd+C (if you’re on a Mac).
  6. Right-click on the column and form the popup menu that appears, press Paste Values from the Paste Options.
  7. This will store the formula results as permanent values in the same column. Now you can go ahead and remove column A if you want to.Copy and paste dates as values from TEXT function

The format code that you put in the formula (at step 2) will vary according to the format you want your month and year to appear in. Here are the format codes along with the type of result you will get when applied to cell A2:

Function Result
=TEXT(A2, “mm/yy”) 02/18
=TEXT(A2, “mm-yy”) 02-18
=TEXT(A2, “mm-yyyy”) 02-2018
=TEXT(A2, “mmm, yyyy”) Feb, 2018
=TEXT(A2, “mmmm, yyyy”) February, 2018

Dates in different formats

So you see, you can use the TEXT function to convert your dates to any format of your choice. All you need to do is change the format code according to your requirement.

Note: Using this formula, your date gets converted to a text format. If you want to convert it back to a date format, you need to use the Format Cells feature.

Also read: How to Convert Text to Date in Excel?

Convert Date to Month and Year using Number Formatting

Excel’s Format Cell feature is a versatile one that lets you perform different types of formatting through a single dialog box.

Here’s how you can convert the dates in our sample dataset to different formats.

  1. Select all the cells containing the dates that you want to convert (A2:A6).
  2. Right-click on your selection and select Format Cells from the popup menu that appears. Alternatively, you can select the dialog box launcher in the Number group under the Home tab.Click on the dialog box launcher
  3. This will open the Format Cells dialog box. Click on the Number tab
  4. Under Category on the left side of the box, select the Date option.
  5. This will display a number of formatting options for date on the right side.
  6. Select the format that you want. For example, if you want to display the first date in the format “Feb-18”, then select the matching format option.Choosing the date number format
  7. If you don’t find an option for the format you want to use, then you can use the Custom option from the Category list on the left. This lets you convert the cell to a custom format.
  8. Look if your format is available among the date format codes under Type. If not, you can type in your format code in the input box just below Type. So, if you want to display the first month in the format “2/18”, then type “m/yy”.Creating custom date format
  9. Click OK to close the Format Cells dialog box.

All your selected cells should now be formatted to your required format.

Date formatted as required

This method differs from the previous one (using the TEXT function) in four ways:

  • With this method, you can perform the operation directly on the original cells.
  • You can get your conversion done in one go. So you don’t need to have a separate cell to enter the formula, then paste by value and then delete the original cells (as you would need to if using the TEXT function).
  • This method changes just the format of the original date, the underlying date, however, remains the same. So if you want to later recover the original date value (along with the day), you can easily access it. With the TEXT function method, however, the original date value is lost because the conversion changes the entire value of the date.
  • The results you get from using this method are of type Date, rather than Text, so you can perform date operations on them directly without having to convert them.

These were three ways in which you can convert date to month and year in Excel. Using these you can convert your date to any format you need.

We hope you found our methods useful and that you will apply it to your own Excel data.

Other Excel tutorials you may like:

  • How to Convert Decimal to Fraction in Excel
  • How to Add Days to a Date in Excel
  • How to Sort by Date in Excel (Single Column & Multiple Columns)
  • How to Convert Serial Numbers to Date in Excel
  • How to Convert Date to Day of Week in Excel
  • How to Convert Month Number to Month Name in Excel
  • How to Convert Days to Years in Excel (Simple Formulas)
  • Convert Military Time to Standard Time in Excel (Formulas)
  • Convert YYYYMMDD to MM/DD/YYYY in Excel

Manytimes, we want to extract month from a date. Extracting them manually not a good idea. Excel provides special MONTH function to get month number from a date. Sum times we want to get month name, like Jan, January, etc. That can be done too.

In this article, we will learn How to get numeric month from date and how to get text month from a date.
Context:
Here I have a list of dates. In the columns adjacent to it I want to get numeric month and text month.
008
Getting Month Number From Date In Excel
Excel has MONTH function that retrieves retrieves month from a date in numeric form.
Generic Formula

=MONTH(date)

Date: It is the date from which you want to get month number in excel.

In cell B2, write this formula and copy it down the cells.

=MONTH(A2)

009
We have our month number in column B.
Getting Text Month From Date In Excel
If you want to get month name in excel from a date than use excel TEXT function.

Generic Formula

=TEXT(date, “mmm”)

=TEXT(date, “mmmm”)

The TEXT function is used to specially formate given values. Now let’s see how we can get month names from date in above example.

Write this formula in cell C2 and drag it down the cells.

This will return the name short month’s name from given date.
0010
If you want full month name then write this formula.

=TEXT(A2, “mmmm”)

0011
Simple, wasn’t it? So yeah guys these are the ways to extract month from date. If you have any query regarding this article or any other excel function, feel free to ask in the comment section below. We are a large community, there’s always someone to solve your Excel/VBA query.

Related Articles:

Calculate Months Between dates in Excel
Get day name from Date in Excel
Vlookup by Date in Excel
SUM if date is between

Popular Articles

50 Excel Shortcut to Increase Your Productivity: Get faster at your task. These 50 shortcuts will make you work even faster on Excel.

How to use the VLOOKUP Function in Excel: This is one of the most used and popular functions of excel that is used to lookup value from different ranges and sheets.

How to use the COUNTIF function in Excel: Count values with conditions using this amazing function. You don’t need to filter your data to count specific values. Countif function is essential to prepare your dashboard.

How to use the SUMIF Function in Excel: This is another dashboard essential function. This helps you sum up values on specific conditions.

Excel spreadsheets provide the ability to work with various types of textual and numerical information. Date processing is also available. In this case, there may be a need to extract from the general meaning of a specific number, for example, a year. There are separate functions for this: YEAR, MONTH, DAY and DAY.



Examples of using functions for date processing in Excel

Excel tables store dates that are presented as a sequence of numeric values. It begins on January 1, 1900. This date will correspond to the number 1. At the same time, January 1, 2009 is laid down in the tables, as the number 39813. This is the number of days between the two designated dates.

The function YEAR is used similarly to the adjacent:

  • MONTH;
  • DAY;
  • WEEKDAY.

All of them display numerical values corresponding to the Gregorian calendar. Even if in the Excel spreadsheet, the Hijra calendar was chosen to display the entered date, then when isolating the year and other composite values by functions, the application will present a number that is equivalent to the Gregorian system of chronology.

To use the YEAR function, you need to enter into the cell the following function formula with one argument:

=YEAR(cell address with date in numeric format)

The function argument is required. It can be replaced by «date_number_number». In the examples below, you can clearly see this. It is important to remember that when displaying the date as text (automatic orientation on the left edge of the cell), the YEAR function will not be executed. Its result will be the # SIGN. Therefore, formatted dates must be presented in a numerical version. Days, months and year can be separated by a dot, slash or comma.

Consider an example of working with the YEAR function in Excel. If we need to get a year from the original date, the function AVAILABLE will not help us since it does not work with dates, but only with text and numeric values. To separate the year, month or day from the full date for this, Excel provides functions for working with dates.

Example: There is a table with a list of dates and in each of them it is necessary to separate the value of only the year.

We introduce the original data in Excel.

Example 1.

To solve the problem, it is necessary to enter the formula in the cells of column B:

=YEAR(the address of the cell, from the date of which you need to isolate the year value)

YEAR function.

As a result, we extract years from each date.

A similar example of the MONTH function in Excel:

MONTH function.

An example of working with functions DAY and WEEKDAY. The DAY function gets to calculate from the date the number of any day:

DAY.

WEEKDAY function returns the number of the day of the week (1-Monday, 2-Tuesday …, etc.) for any date:

WEEKDAY.

In the second optional argument of the WEEKDAY function, the number 2 may specified for our day of the week countdown format (Monday-1 through Sunday-7):

 number 2 may specified for our day.

If you omit the second optional argument, then the default format will be used (English from Sunday-1 to Saturday-7).

Create a formula of the combination of the functions INDEX and WEEKDAY:

functions INDEX and WEEKDAY.

We obtain a more understandable form of the implementation of this function.



Examples of the practical use of functions for working with dates

These primitive functions are very useful when grouping data by: years, months, days of the week, and specific days.

Suppose we have a simple sales report:

Example 2.

We need to quickly organize data for visual analysis without using pivot tables. To do this, we will bring the report into a table where it is convenient and quickly to group data by year, month and day of the week:

pivot tables.

Now we have a tool to work with this sales report. We can filter and segment data by specific time criteria:

sales report 2017.

In addition, you can make a histogram to analyze the best-selling days of the week, to understand which day of the week has the largest number of sales:

the best-selling days.

In this form, it is very convenient to segment sales reports for long, medium and short periods of time.

It should be immediately noted that in order to get the difference between the two dates, none of the above functions will help us. For this task, you should use a specially designed function DATEDIF:

DATEDIF.

Download examples fo functions YEAR MONTH DAY WEEKDAY and DATEDIF

The type of values in the date cells requires a special approach to data processing. Therefore, you should use the appropriate type of function in Excel.

Понравилась статья? Поделить с друзьями:
  • Excel date month extract
  • Excel date from days to years
  • Excel date from calendar
  • Excel date format short date
  • Excel date format date and time