Day month year to month day year in excel

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?

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.

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

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.

If you’ve ever needed to split dates in Excel into separate day, month, and year, there are several options to choose from. Excel has different functions, Text to Columns or Flash Fill which can do the job.

Here’s a quick guide on several methods:

  • Using the DAY, MONTH and YEAR functions
  • Using Text to Columns
  • Flash Fill
  • TextSplit() a new Excel 365 function combined with Text()

DAY, MONTH and YEAR Functions

Using these simple Excel formulas, you can extract the day, month, or year only from a date cell.

This is the best way if the dates might change or more added but only works for dates that are saved as Excel dates (not in plain text).

Day Function

The DAY function returns the day of the month as a number (obviously between 1 and 31).

Syntax

=DAY(serial_number)

So, for the example above, if we select cell C2 and input =DAY(A2) and then press Enter, we will receive the DAY result of 25.

Month Function

The MONTH function returns the month of the year as a number (obviously between 1 and 12).

Syntax

=MONTH(serial_number)

So, for the example above, if we select cell D2 and input =MONTH(A2) and then press Enter, we will receive the MONTH result of 10.

Year Function

The YEAR function returns the year component as a four-digit number.

Syntax

=YEAR(serial_number)

So, for the example above, if we select cell E2 and input =YEAR(A2) and then press Enter, we will receive the YEAR result of 1991.

Alternatively, you can use the date within the formula instead.

For example, instead of selecting the cell, you would use =YEAR((DATE(1991,10,25))) for the 25th of October, 1991 – which would produce the results of 1991. We think that having the date already inputted within your cell and using the cells only, is a simpler and less complicated way to go about it.  

Text to Columns

Another way around it would be using the Text to Columns function in excel to split your date into the day, month, and year within three columns.

This works with either Excel date cells or dates as plain text.  It’s a ‘one-off’ process which won’t split any dates that are added or changed later.

Firstly, you’ll need to highlight your existing date column.  

Next, go to Data | Data Tools | Text to Columns

This will bring up the Convert Text to Columns Wizard.

You’ll need to ensure Delimited is selected, in this case the Text Wizard has already determined that the data is Delimited.

Then you can click next, which will bring up the option to set the delimiters.

Under the delimiters section, tick the Other box only, and input / within the box. Then you can select next.

For Step 3 of 3, click in the box next to Destination, then select the cell within your Excel spreadsheet like we’ve done so below.

You can also select the Column data format from General to Date and choose which Date format you would prefer from the drop-down list.

Then select Finish so that Excel can input the results. Now we have three separate columns with the day, month, and year.

From there, you can format the results into a table if you prefer.

Flash Fill to split dates

Flash Fill is like ‘Text to Columns’ but is done automatically.  You type in some examples of the split you want, Excel detects that and continues it down the column.

See Flash Fill Magic in Excel

This works with either Excel date cells or dates as plain text.  It’s a ‘one-off’ process which won’t split any dates that are added or changed later.

Here, we’ve started typing the day numbers in column B, Excel detects the match with text in Col A and shows what it will ‘Flash Fill’ if you simply press Enter.

You can do the same with the day name, month or year.

TextSplit

TextSplit() is one of the new text splitting functions in Excel 365. They work for cells with text strings but not date cells that appear as text. Converting Excel dates to text and vice-versa

Here’s an example of the difference.

Row 18 has a date cell in Col A, TextSplit can’t work and returns the serial date value.
Cell A19 is plain text, TextSplit(A19,”,”) works OK and separates each part into it’s own cell. Note there’s no comma between month and day.
Row 20 has another date cell and shows how to text split from a serial date cell. In Col B we’ve added Text() function to convert the date into text with commas separating each element (including Month) so that TextSplit() can separate out all four parts.

Comparing TextSplit() with a date cell (row 18), a text cell showing a date string (row 19). A20 is a date cell, B20 uses Text() to convert the date to text before splitting.

How to use Excel’s Accessibility Ribbon 
More powerful Excel Autofill using Series 
Converting Excel dates to text and vice-versa

If you have a date column in your Excel spreadsheet and need to separate it into day, month, and year, you may be wondering how to do so efficiently. This post will guide you through four different methods for splitting a date into day, month and year using Excel formulas, Text to Columns, Flash Fill, and VBA Code. How do I quickly split date as Day, Month and Year using Formulas or Text to Columns feature in Excel.

Table of Contents

  • 1. Split Date into Day Month and Year with Formulas
  • 2. Split Date into Day Month and Year with Text to Column Feature
  • 3. Split Date into Day, Month and Year with Flash Fill Feature
  • 4. Split Date into Day, Month and Year with VBA Code
  • 5. Video: Split Date into Day Month and Year
  • 6. Conclusion
  • 7. Related Functions

1. Split Date into Day Month and Year with Formulas

Assuming that you have a list of data in range A1:A6, which contain date values. And you want to split each date value into three separate columns for day, month and year. How to achieve it. You can use three formulas based on the DAY function, the Month function and the Year function to achieve the result of splitting dates. Just do the following steps:

Step1: type Day string in a blank cell in a new column, such as: B1, and type Month string in Cell C1, type Year string in Cell D1.

split date into day month year1

Step2: Type the following formula in Cell B2, and press Enter key, then drag the AutoFill Handle over to other cells to apply this formula.

=DAY(A2)

split date into day month year2

This formula will extract Day Value from the given date in range A2:A6.

Step3: Type the following formula based on the Month function to get Month value from date in Cell C2, and press Enter key, and then drag the AutoFill Handle over to other cells to apply this formula.

=MONTH(A2)

split date into day month year3

This formula will extract Month value from the given date in range A2:A6

Step4: Type the following formula in Cell D3 to get the Year value, and press Enter key, and then drag the AutoFill Handle over other cells.

=Year(A2)

split date into day month year4

You should see that all dates in range A2:A6 have been split into separate day, month and year.

2. Split Date into Day Month and Year with Text to Column Feature

You can also use Text to Column options to achieve the same result of splitting date into separate day, month and year in three columns. You just need to do the following steps:

Step1: select the range of cells that you want to split.

split date into day month year5

Step2: go to DATA tab, click Text to Columns command under Sort & Filter group. And the Convert Text to Columns Wizard dialog will open.

split date into day month year6

Step3: select Delimited as the file type, and click Next button.

split date into day month year7

Step4: only check Other checkbox under Delimiter section, type the delimiter / into the Other text box, and click Next button.

split date into day month year8

Step5: select one Destination cell, such as: B2, click Finish button.

split date into day month year9

Step6: the date column has been split into separate day, month and year.

split date into day month year10

3. Split Date into Day, Month and Year with Flash Fill Feature

Flash Fill can quickly and easily split a date column into day, month, and year components in Excel. Just do the following steps:

Step1: First select three new columns to the right of the date column.

Step2: In the first new column, enter the first value you want to extract. For example, the day value.

Step3: In the second new column, enter the second value you want to extract. For example, the month value.

Step4: In the third new column, enter the third value you want to extract. For example, the year value.

How to Split Date into Day, Month and Year flash fill 1.png

Step5: Click on the first day value in the first new column, then click on Flash Fill command under Data Tools group in Data tab.

How to Split Date into Day, Month and Year flash fill 2.png

Step6: Excel will automatically show the suggested day values in the remaining cells of the new column.

How to Split Date into Day, Month and Year flash fill3.png

Step7: Repeat step 6 for the remaining two new columns to extract the month and year values.

How to Split Date into Day, Month and Year flash fill4.png

Once you have extracted all three values, you can delete the original date column and the temporary columns containing the extracted values.

How to Split Date into Day, Month and Year flash fill5.png

4. Split Date into Day, Month and Year with VBA Code

You can also use VBA code to split a date into day, month, and year components in Excel. Just do the following steps:

Step1: Open your Excel workbook and press ALT + F11 to open the Visual Basic Editor.

Step2: Click on “Insert” from the top menu and choose “Module” to create a new module.

Step3: Copy and paste the following code into the module, Save the module and close the Visual Basic Editor.

How to Split Date into Day, Month and Year vba code1.png

Sub SplitDate_excelgeek()
    Dim dateRange As Range
    Set dateRange = Application.InputBox("Select the range of cells containing the dates to split", Type:=8)
    Dim cell As Range
    For Each cell In dateRange
        Dim dayValue As Integer
        Dim monthValue As Integer
        Dim yearValue As Integer
        dayValue = Day(cell.Value)
        monthValue = Month(cell.Value)
        yearValue = Year(cell.Value)
        cell.Offset(0, 1).Value = dayValue
        cell.Offset(0, 2).Value = monthValue
        cell.Offset(0, 3).Value = yearValue
    Next cell
End Sub

Step4: Click on “Macros” under the “Code” group. Select the “SplitDate_excelgeek” macro from the list and click on “Run“.

How to Split Date into Day, Month and Year vba code2.png

Step5: select the range of cells containing the date values that you want to split. For example, select range of cells A2:A5.

How to Split Date into Day, Month and Year vba code3.png

Step6: The VBA Macro will split the selected date column into day, month, and year components and place the results in the adjacent columns.

How to Split Date into Day, Month and Year vba code4.png

This video tutorial will guide you on how to split a date into day, month, and year components using various methods in Excel.

6. Conclusion

Whether you need to work with a large dataset or just a few dates, these methods can help you quickly and accurately separate your date values into separate columns.

  • Excel YEAR function
    The Excel YEAR function returns a four-digit year from a given date value, the year is returned as an integer ranging from 1900 to 9999. The syntax of the YEAR function is as below:=YEAR (serial_number)…
  • Excel MONTH function
    The Excel MONTH function returns the month of a date represented by a serial number. And the month is an integer number from 1 to 12. The syntax of the MONTH function is as below:=MONTH (serial_number)…
  • Excel DAY function
    The Excel DAY function returns a day of a date (from 1 to 31).The DAY function is a build-in function in Microsoft Excel and it is categorized as a DATE and TIME Function.The syntax of the DAY function is as below:= DAY (date_value)…

Понравилась статья? Поделить с друзьями:
  • Datamatrix код в excel
  • Datagridview vb net and excel
  • Dataframe экспортировать в excel
  • Dataframe to excel without index
  • Dataformat error входные данные не удалось распознать как допустимый документ excel сведения binary