The Wayback Machine - https://web.archive.org/web/20240918004724/https://www.geeksforgeeks.org/how-to-convert-date-to-number-string-or-text-format-in-excel/
Open In App

How To Convert Date To Number String Or Text Format In Excel?

Last Updated : 16 Nov, 2022
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Excel’s built-in date system by default supports dates between January 1, 1900, and December 31, 9999. In this range, the numbers start at 1 and increase by 1 each time. In addition to text and numeric data types, Excel also allows dates that are internally stored as serial numbers. In Excel, the date format is typically recognized by default. However, Excel also allows you to input date format by choosing the cell and pressing (Ctrl+;).

Methods to Convert Date to Number String

DATEVALUE Function

Syntax: =DATEVALUE (date_text)

Where date_text is the only argument

Datevalue-function

DATEVALUE Function

Cell Formatting

Step 1: Once the cell with the value has been chosen, click the home tab and choose the NUMBER or TEXT option.

Choosing-number-option-from-home

 

Step 2: The cell format then changes into the original serial number internally stored by Excel.

Cell-format-changes

 

Note: The first serial number stored by excel is of date 01/01/1900.

First-serial-number-stored

 

Methods to Convert Date to Text

TEXT Function

It is used to convert a date into a specified text format. 

Syntax: =TEXT(value, format_text)

For today’s date: =TEXT(TODAY(), format_text)

Where value: The value that needs to be converted. This could be a numeric cell reference or value, or a numeric value returned by a formula.
format_text: The format to display the number. It should be in double quotes.

There are different formats possible for the day, month, year, and separator.

 

Value

Meaning

Day
  1. d
  2. dd
  3. ddd
  4. dddd
  1. Number without leading 0 (Eg: 6)
  2. Number with leading 0 (Eg: 06)
  3. Day in short form (Eg: Mon)
  4. Day in full form (Eg: Monday)
Month
  1. m
  2. mm
  3. mmm
  4. mmmm
  1. Month number without leading 0 (Eg: 8)
  2. Month number with leading 0 (Eg: 08)
  3. Month three-letter abbreviation (Eg: Jan)
  4. Month full form (Eg: January)
Year
  1. yy
  2. yyyy
  1. Year in two-digit (Eg: 16)
  2. Year in four-digit (Eg: 2016)
Separator
  1. / (slash)
  2. – (dash)
  3. . (dot)
  4. , (comma)
  1. 10/10/2020
  2. 10-10-2020
  3. 10.10.2020
  4. 10 Oct, 2020

Text-function-applied

 

Formula-for-date-to-text

 

Adding Apostrophe

An apostrophe can be added in the formula bar where the date is entered to make it text. In some excel versions, adding space in the formula bar adds the apostrophe itself.

After-adding-apostrophe-in-formula-bar

 

Format Cell Option

Step 1: Either select the cells, right click and click on the FORMAT CELL option, or in the Home Tab, select Cell then format and click on the FORMAT CELL. 

Selecting-format-cell-option

 

Step 2: In the Custom option of the Number Tab, specify the format. Click Ok.

Specifying-format

 

Format-cell-result

 

Text to Column

Step 1: Select the cells. Go to the Data tools in the Data tab. Click on Text to Column. 

Selecting-text-to-column-from-data-tools

 

Step 2: In the next widget, choose delimited and click next.

Choosing-delimited-option

 

Step 3: In the next screen, deselect all the delimiters and click next. 

Deselecting-delimiters

 

Step 4: Finally, enter the destination cell number and click finish.

Entering-destination-cell

 

Note: The Text to Column tool will always convert dates to the short date format according to your system.

Text-to-column-result

 

Copy-Paste Through Notepad

Step 1: Copy the selected cells with date and paste them to Notepad. The dates are instantly transformed into text when pasted into the notepad.

Pasting-content-in-notepad

 

Step 2: The target cells should be chosen and changed to the Text Cell Format in the next step.

Target-cells-changed-to-text-format

 

Step 3: Finally, paste the content in the target cells. It will be in the text format as shown in the figure.

Notepad-result

 

VBA

VBA is located in Excel’s “Developer” tab.

Step 1: The “Developer” tab must first be enabled before it can be accessed from the ‘File’ option.

Clicking-options-from-file-menu

 

Step 2: Select Customize Ribbon from Options. Check the Developer box from the right menu.

Go-to-customize-ribbon

 

VBA is now enabled. We can access VBA Editor through the Developer tab or the keyboard shortcut ALT + F11.

VBA-enabled

Visual Basic from Developer Tab

Step 3: Insert Module in the workbook. 

Inserting-module

 

Step 4: Add the following code to convert Date to Text. Name the function ToText in the blank next to General. Click on Run Button.

Sub toText()
Dim d as Range
For Each d in Selection
d.Value = Format(d.Value, “dd.mm.yyyy”)
Next d
End Sub

Adding-code-to-text-function

 

Step 5: In the next Dialog Box, click No and change the Extension to “Excel Macro-Enabled Workbook” to save it.

Saving-macro-enabled-workbook

 

Step 6: Macros in VBA are a collection of codes that form a programming language. In the excel sheet, add a macro button for the above code by adding a shape/ text box. Add the text “Convert to Text” in the shape.

Inserting-shape

 

Step 7: Right-click the text box and choose “Assign Macro” for the toText code to make it a clickable button. 

Assigning-macro

Step 7: Assign macro to the button

Finally, using the created button, we can change the date to text in the format specified in the code.

Result-through-vba

 



Similar Reads

How to Convert Text to Date in Excel
Have you ever found yourself staring at a column of dates in Excel, only to realize they’re formatted as text? It's a common problem that can hinder your data analysis and reporting tasks. Fortunately, converting text to date in Excel is straightforward. If you're looking to use the Text to Columns feature or need to convert a number to date in Exc
5 min read
Custom Format to Show Units Without Changing Number to Text in Excel
Microsoft Excel is a great software that is used by individuals to store data in the form of spreadsheets in a formatted manner. Microsoft Excel allows us to store a variety of data such as characters, text, numbers, decimals, date, time, etc. Since Excel is a smart tool, it automatically identifies the data type of the records and places them acco
3 min read
How to Create a Custom Date Format in Excel?
Date formatting is very important when you prepare any set of data, then there are different types of formatting used for different categories, which are different from our normal formatting which is dd/mm/yyyy. When you enter any date in MS-Excel then excel considers it as the default format of date as your computer has, but you can change their f
3 min read
How to Calculate End Date from Start Date and Duration in Excel?
Excel is a powerful data visualization and analysis software, which uses spreadsheets for managing, storing, and visualizing a large amount of data. A cell, a rectangular block is used to store each unit of data. This tool can be used to visualize trends or compare data by creating graphs, or get insights from the data using functions and formulas.
2 min read
How to Combine Text with Date or Time in Excel?
Microsoft Excel allows its users to store and manage different varieties of data in the form of rows and columns and store it inside an Excel workbook. Since Microsoft Excel allows its users to not only store data but also manipulate that data later on as per their needs. Combine Text with Date or Time in Excel Let's assume a scenario where a user
3 min read
How to Convert Data from Wide to Long Format in Excel
Do you find your Excel data hard to analyze? Sometimes, changing the way your data is arranged can make it much easier to understand. Converting data from wide format to long format can help you organize your spreadsheet better, making it simpler to spot trends and patterns. This method is useful for business reports, school projects, and more. In
3 min read
How to Convert Scientific Notation to Text or Number in Excel?
Microsoft Excel is a universal software tool that is used by companies throughout the world to store data/numbers in the form of a spreadsheet. Excel not only helps users to store the data into spreadsheets, but it also gives us the freedom to use multiple smart features to manipulate, organize and analyze the raw data. Some of these helpful smart
5 min read
Custom Excel Number Format
MS Excel is a very important tool for businesses as well as for individuals with very useful features and tools. It is a market leader in spreadsheet editing and managing software. MS Excel contains many inbuilt number formats that can be used as per the needs of the user, however, sometimes users may need specific custom number formats that are no
2 min read
How to Find the Longest or Shortest Text String in a Column in Excel?
In this article, we will see how to find the longest or shortest text string in a column in Excel? Usually, for finding the longest or shortest string we can visit the all string in columns one by one and compare them to get results. This seems to work when you have less amount of data in an excel sheet. This is not a particle with a large dataset
4 min read
How to Extract Text Only from Alphanumeric String in Excel?
In the vast landscape of Excel spreadsheets, managing data efficiently is crucial for streamlined analysis and reporting. Often, one encounters the challenge of dealing with cells containing a mix of letters and numbers, commonly known as alphanumeric strings. Extracting only the text component from such strings becomes essential for various data m
4 min read
How to Extract the last N Words from Text String in Excel
Excel is a tool for storing and managing a large amount of data. Data is entered in a rectangular block, which we called a cell. This tool can be used to perform different tasks like creating graphs and analyzing trends, to get insights from the data. It is primarily used for financial data analysis by accounting professionals. Let's learn how to e
3 min read
Format Reports in Excel
Excel 2013 introduces the Format pane. It offers advanced formatting choices in clean, bright new task windows, and it is also highly useful. When you alter the theme, it is applied to all Power View Views in the Report and Sheets in the Workbook. You may also modify the size of the text in all of your Report Elements. You can add Background Images
4 min read
How to Format Chart Axis to Percentage in Excel?
By default, in Excel, the data points in the axis are in the form of integers or numeric representations. Sometimes we need to express these numeric data points in terms of percentages. So, Excel provides us an option to format from number representation to percentage. In this article, we are going to discuss how to format a chart axis to percentag
2 min read
How to Format Numbers in Thousands and Millions in Excel?
Microsoft Excel allows its users to store raw data in a well-structured format in a spreadsheet. The spreadsheets consist of numerous cells in the form of rows and columns in which an individual can store data. An Excel spreadsheet can store different types of data such as numbers, characters, strings, dates, date-time, etc. A lot of the time when
4 min read
Excel Format Painter
Imagine you spend a lot of time making a cool-looking chart in Excel, with just the right colors and fonts. But then you need to copy that look to other charts. No need to do it manually! Excel's Format Painter is like a copy-and-paste button for formatting. You just pick the pretty chart, click the painter, and then brush it onto the other charts.
7 min read
Editing Excel Macros in Excel
Excel Macro is a set of actions that can be recorded, saved, used multiple times. This feature saves us a lot of time when dealing with repetitive tasks and huge data sets. We can always make changes to an existing Macro in Excel. There are two ways to record and run macros: Excel Commands Excel Visual Basic for Applications(VBA).1. Copying a Macro
1 min read
How to Automatically Insert Date and Timestamp in Excel?
The Date and Timestamp is a type of data type that determines the date and time of a particular region. It contains some characters along with some encoded data. This format may vary from language to language. Keeping track of date and time helps in managing records of our work as well as segregate the information day-wise. In this article, we will
4 min read
How to Remove Time from Date/Timestamp in Excel?
Timestamp stores a combined Date and Time value. In this article, we will look at how we can create Timestamp and remove Time from Date in Excel. To do so follow the steps below: Step 1: Formatting data to create a timestamp. Select the cell, right-click on it choose Format Cells... Step 2: Then in the Formal Cells box select Custom in Category and
3 min read
VBA Date and Time Functions in Excel
Date and Time Functions are the inbuilt functions that give us the opportunity to see the date or time according to the user's need. Suppose a user needs to see the month or the day or the year then it can be easily seen by different date functions. Similarly, for the time function, also we can manipulate it according to the need of the user. Date
5 min read
How to Round Date to Previous or Next Specific Weekday in Excel?
The WEEKDAY function produces a number between 1 and 7 that corresponds to specific days of the week. WEEKDAY, by default, assumes a Sunday-based week and allocates 1 to Monday, 2 to Tuesday, etc., with 7 given to Sunday. In order to retrieve the prior weekday occurring before a given date in Excel, we must utilize the WEEKDAY function. In order to
4 min read
Date Modifications with Power Query in Excel
A data preparation and transformation engine is Power Query. Power Query includes a Power Query Editor for implementing transformations as well as a graphical interface for obtaining data from sources. With Power Query (also referred to as Get & Transform in Excel), you may import or connect to external data and then modify that data to match y
7 min read
Excel Date Functions with Formula Examples
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 perform
12 min read
Excel Date and Time Formats With Examples
Excel has a built-in time feature that is simple to use and can save you a lot of time. We can insert current Data and Time into a worksheet cell using Excel's built-in functions. When you enter a date or time into a cell, the date and time are displayed in the cell's default date and time format. The regional date and time settings entered in Cont
4 min read
How to Sort by Date in Excel?
Excel provides various types of sorting formats e.g. “sort A to Z”, “Sort Z to A”, “Sort by color” and “Sort by date” etc. Sorting in Excel is nothing but arranging data into some meaningful order to make it easier to understand, analyze, or visualize. Here, we will be discussing how to sort by Date in Excel whether it may be Years, Months, Days, o
6 min read
How to Convert Weekday Name to Number in Excel?
MS-Excel is a program that is part of the Microsoft Office suite. It's a multi-row, multi-column electronic spreadsheet that's used to organize data, visualize data, and do various calculations/operations. Each row and column comprise a cell, each sheet contains 1048576 rows and 16383 columns. Each cell has an address that is determined by the colu
5 min read
How to Convert Exponential Large Number to Normal Integer in Excel?
Excel is powerful data visualization and data management tool which can be used to store, analyze, and create reports on large data. It is generally used by accounting professionals for the analysis of financial data but can be used by anyone to manage large data. Data is entered into the rows and columns. Converting Exponential Large Number to Nor
2 min read
How to Format Text Into Code Block on Discord
Discord is one of the popular communication and collaboration software. It is used by a wide variety of people for different use purposes. While some use it for personal messaging, others use it for work purposes, while gamers use it for communication, etc. However, presenting code in a clean and organized manner can sometimes prove challenging ami
7 min read
How to Extract Text before @ Sign from an Email Address in Excel?
You got a dataset and you want to extract the name part of the email address. This task can be done with a text to column and formula that uses the LEFT and FIND functions. Using LEFT and FIND functionsThe LEFT function: The LEFT function returns a given text from the left of our text string based on the number of characters specified. Syntax: LEFT
3 min read
How to Fit Long Text in Excel Spreadsheets?
By default, when you create a new workbook in Excel, the row height and column width for all cells are set to the same value. If the text you enter in a spreadsheet cell is too long and the next column has data, it either spills over into the next blank cell or is truncated by the data in the adjacent cells. Although you can widen the columns, ther
4 min read
How to Expand Cells to Fit the Text Automatically in Excel?
We all know how useful Excel is to store tabular data. We can do calculations in excel, we can store any information that is in the form of tables, and so on. But there are some common problems that we all face while using Excel. One of the problems that we encounter while entering oversized, overlength data in a cell. Whenever we enter any data th
2 min read
Article Tags :