String or Text String Definition and Use in Excel

The word DATA spelled out using pins and string

 Marcus Franzen / Getty Images

A text string, also known as a string or simply as text, is a group of characters that are used as data in a spreadsheet program. Text strings are most often comprised of words, but may also include letters, numbers, special characters, the dash symbol, or the number sign. By default, text strings are left-aligned in a cell while number data is aligned to the right.

Note:

The information in this article applies to Excel 2019, Excel 2016, Excel 2013, Excel 2010, Excel for Mac, and Excel Online.

Format Data as Text

Cells Formatted as Text in Excel

Text strings usually begin with a letter of the alphabet, but any data entry that is formatted as text is interpreted as a string.

Convert Numbers and Formulas to Text with the Apostrophe

An apostrophe converts formulas to text in Excel

Text strings are also created in Excel and Google Sheets by entering an apostrophe ( ' ) as the first character of data.

The apostrophe is not visible in the cell but forces the program to interpret whatever numbers or symbols are entered after the apostrophe as text.

For example, to enter a formula, such as =A1+B2, as a text string, type:

'=A1+B2

The apostrophe, while not visible, prevents the spreadsheet program from interpreting the entry as a formula.

Convert Text Strings to Number Data in Excel

At times, numbers copied or imported into a spreadsheet are changed into text data. This causes problems if the data is being used as an argument for some of the program's built-in functions, such as SUM or AVERAGE. Options for fixing this problem include using Paste Special or the Error button.

Convert Text to Numbers With Paste Special

Excel Paste Special

Using paste special to convert text data to numbers is relatively easy. It also keeps the converted data in its original location. This is different than the VALUE function which requires the converted data to reside in a different location from the original text data.

Convert Text to Numbers Using the Error Button

Excel Error Button

As shown in the image above, the Error button, or Error Checking button, in Excel is a small yellow rectangle that appears next to cells that contain data errors. You'll see it when number data formatted as text is used in a formula.

To use the Error button to convert the text data to numbers:

  1. Select the cell(s) containing the bad data.

  2. Select the Error button (yellow exclamation sign) next to the cell to open a context menu.

  3. Select Convert to Number.

The data in the selected cells is converted to numbers.

Concatenate Text Strings in Excel and Google Spreadsheets

In Excel and Google Spreadsheets, the ampersand (&) character joins together or concatenates text strings located in separate cells in a new location. For example, if column A contains first names and column B contains last names of individuals, the two cells of data can be combined together in column C.

The formula that does this is:

=(A1&" "&B1)

The ampersand operator doesn't automatically put spaces between the concatenated text strings. To add spaces to a formula, surround a space character (entered using the space bar on the keyboard) with quotation marks.

Another option for joining text strings is to use the CONCATENATE function.

Split Text Data into Multiple Cells With Text to Columns

To do the opposite of concatenation, to split one cell of data into two or more separate cells, use the Text to Columns feature.

To split data in a cell, follow these steps:

  1. Select the column of cells containing the combined text data.

  2. Select the Data tab.

    Excel Data tab
  3. Select Text to Columns to open the Convert Text to Columns wizard.

    Text to Columns
  4. Select Delimited and select Next.

    Convert Text to Columns Delimited Data
  5. Choose the correct text separator or delimiter for your data, such as Tab or Space, and select Next.

    Text to Columns delimiter
  6. Choose a column data format, such as General, and select Advanced.

    Column data format
  7. Choose alternative settings for the Decimal separator and Thousands separator if the defaults, the period and the comma respectively, are not correct. After you've made your changes, select OK.

    Advanced Text Import Settings dialog box
  8. Select Finish to close the wizard and return to the worksheet.

    Text to Columns finished
  9. The text in the selected column is separated into two or more columns.

Was this page helpful?