Excel numbers are text

Convert numbers stored as text to numbers

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 Excel Web App Excel 2010 Excel 2007 Excel for Mac 2011 Excel Starter 2010 More…Less

Numbers that are stored as text can cause unexpected results, like an uncalculated formula showing instead of a result. Most of the time, Excel will recognize this and you’ll see an alert next to the cell where numbers are being stored as text. If you see the alert, select the cells, and then click Excel Error Alert button to choose a convert option. 

Check out Format numbers to learn more about formatting numbers and text in Excel.

Cells with numbers stored as text with green triangles

If the alert button is not available, do the following:

1. Select a column

Selected column

Select a column with this problem. If you don’t want to convert the whole column, you can select one or more cells instead. Just be sure the cells you select are in the same column, otherwise this process won’t work. (See «Other ways to convert» below if you have this problem in more than one column.)

2. Click this button

Data tab, Text to Columns button

The Text to Columns button is typically used for splitting a column, but it can also be used to convert a single column of text to numbers. On the Data tab, click Text to Columns.

3. Click Apply

The rest of the Text to Columns wizard steps are best for splitting a column. Since you’re just converting text in a column, you can click Finish right away, and Excel will convert the cells.

4. Set the format

Currency format selected

Press CTRL + 1 (or Image of the MAC Command button icon + 1 on the Mac). Then select any format.

Note: If you still see formulas that are not showing as numeric results, then you may have Show Formulas turned on. Go to the Formulas tab and make sure Show Formulas is turned off.

Other ways to convert:

You can use the VALUE function to return just the numeric value of the text.

1. Insert a new column

New column next to text numbers

Insert a new column next to the cells with text. In this example, column E contains the text stored as numbers. Column F is the new column.

2. Use the VALUE function

Cell F23 with formula: =VALUE(E23) and result of 107.71

In one of the cells of the new column, type =VALUE() and inside the parentheses, type a cell reference that contains text stored as numbers. In this example it’s cell E23.

3. Rest your cursor here

Cursor resting on lower-right corner of cell

Now you’ll fill the cell’s formula down, into the other cells. If you’ve never done this before, here’s how to do it: Rest your cursor on the lower-right corner of the cell until it changes to a plus sign.

4. Click and drag down

Cursor dragged down, cells filled with formula

Click and drag down to fill the formula to the other cells. After that’s done, you can use this new column, or you can copy and paste these new values to the original column. Here’s how to do that: Select the cells with the new formula. Press CTRL + C. Click the first cell of the original column. Then on the Home tab, click the arrow below Paste, and then click Paste Special > Values.

If the steps above didn’t work, you can use this method, which can be used if you’re trying to convert more than one column of text.

  1. Select a blank cell that doesn’t have this problem, type the number 1 into it, and then press Enter.

  2. Press CTRL + C to copy the cell.

  3. Select the cells that have numbers stored as text.

  4. On the Home tab, click Paste > Paste Special.

  5. Click Multiply, and then click OK. Excel multiplies each cell by 1, and in doing so, converts the text to numbers.

  6. Press CTRL + 1 (or Image of the MAC Command button icon + 1 on the Mac). Then select any format.

Connect with an expert. Learn from live instructors.

Related topics

Replace a formula with its result

Top ten ways to clean your data

CLEAN function

Need more help?

Excel for Microsoft 365 Excel for the web Excel 2021 Excel 2019 Excel 2016 Excel 2013 Excel 2010 Excel 2007 More…Less

If you want Excel to treat certain types of numbers as text, you can use the text format instead of a number format. For example, If you are using credit card numbers, or other number codes that contain 16 digits or more, you must use a text format. That’s because Excel has a maximum of 15 digits of precision and will round any numbers that follow the 15th digit down to zero, which probably isn’t what you want to happen.

It’s easy to tell at a glance if a number is formatted as text, because it will be left-aligned instead of right-aligned in the cell.

  1. Select the cell or range of cells that contains the numbers that you want to format as text. How to select cells or a range.

    Tip: You can also select empty cells, and then enter numbers after you format the cells as text. Those numbers will be formatted as text.

  2. On the Home tab, in the Number group, click the arrow next to the Number Format box, and then click Text.

    Note: If you don’t see the Text option, use the scroll bar to scroll to the end of the list.

    apply text format to numbers

Tips: 

  • To use decimal places in numbers that are stored as text, you may need to include the decimal points when you type the numbers.

  • When you enter a number that begins with a zero—for example, a product code—Excel will delete the zero by default. If this is not what you want, you can create a custom number format that forces Excel to retain the leading zero. For example, if you’re typing or pasting ten-digit product codes in a worksheet, Excel will change numbers like 0784367998 to 784367998. In this case, you could create a custom number format consisting of the code 0000000000, which forces Excel to display all ten digits of the product code, including the leading zero. For more information about this issue, see Create or delete a custom number format and Keep leading zeros in number codes.

  • Occasionally, numbers might be formatted and stored in cells as text, which later can cause problems with calculations or produce confusing sort orders. This sometimes happens when you import or copy numbers from a database or other data source. In this scenario, you must convert the numbers stored as text back to numbers. For more information, see Convert numbers stored as text to numbers.

  • You can also use the TEXT function to convert a number to text in a specific number format. For examples of this technique, see Keep leading zeros in number codes. For information about using the TEXT function, see TEXT function.

Need more help?

Excel is a great tool which can be used for data entry, as a database, and to analyze data and create dashboards and reports.

While most of the in-built features and default settings are meant to be useful and save time for the users, sometimes, you may want to change things a little.

Converting your numbers into text is one such scenario.

In this tutorial, I will show you some easy ways to quickly convert numbers to text in Excel.

Why Convert Numbers to Text in Excel?

When working with numbers in Excel, it’s best to keep these as numbers only. But in some cases, having a number could actually be a problem.

Lets look at a couple of scenarios where having numbers creates issues for the users.

Keeping Leading Zeros

For example, if you enter 001 in a cell in Excel, you will notice that Excel automatically removes the leading zeros (as it thinks these are unnecessary).

While this is not an issue in most cases (as you wouldn’t leading zeros), in case you do need these then one of the solutions is to convert these numbers to text.

This way, you get exactly what you enter.

One common scenario where you might need this is when you’re working with large numbers – such as SSN or employee ids that have leading zeros.

Entering Large Numeric Values

Do you know that you can only enter a numeric value that is 15 digits long in Excel? If you enter a 16 digit long number, it will change the 16th digit to 0.

So if you are working with SSN, account numbers, or any other type of large numbers, there is a possibility that your input data is automatically being changed by Excel.

And what’s even worse is that you don’t get any prompt or error. It just changes the digits to 0 after the 15th digit.

Again, this is something that is taken care of if you convert the number to text.

Changing Numbers to Dates

This one erk a lot of people (including myself).

Try entering 01-01 in Excel and it will automatically change it to date (01 January of the current year).

So if you enter anything that is a valid date format in Excel, it would be converted to a date.

A lot of people reach out to me for this as they want to enter scores in Excel in this format, but end up getting frustrated when they see dates instead.

Again, changing the format of the cell from number to text will help keep the scores as is.

Now, let’s go ahead and have a look at some of the methods you can use to convert numbers to text in Excel.

Convert Numbers to Text in Excel

In this section, I will cover four different ways you can use to convert numbers to text in Excel.

Not all these methods are the same and some would be more suitable than others depending on your situation.

So let’s dive in!

Adding an Apostrophe

If you manually entering data in Excel and you don’t want your numbers to change the format automatically, here is a simple trick:

Add an apostrophe (‘) before the number

So if you want to enter 001, enter ‘001 (where there is an apostrophe before the number).

And don’t worry, the apostrophe is not visible in the cell. You will only see the number.

Number converted to text by adding an apostrophe

When you add an apostrophe before a number, it will change it to text and also add a small green triangle at the top left part of the cell (as shown in th image). It’s Exel way to letting you know that the cell has a number that has been converted to text.

When you add an apostrophe before a number, it tells Excel to consider whatever follows as text.

A quick way to visually confirm whether the cells are formatted as text or not is to see whether the numbers align to the left out to the right. When numbers are formatted as text, they align to the right by default (as they alight to the left)

Number with an without apostrophe
Adding an apostrophe changes cell alignment to left

Even if you add an apostrophe before a number in a cell in Excel, you can still use these as numbers in calculations

Similarly, if you want to enter 01-01, adding an apostrophe would make sure that it doesn’t get changed into a date.

Although this technique works in all cases, it is only useful if you’re manually entering a few numbers in Excel. If you enter a lot of data in a specific range of rows/columns, use the next method.

Converting Cell Format to Text

Another way to make sure that any numeric entry in Excel is considered a text value is by changing the format of the cell.

This way, you don’t have to worry about entering an apostrophe every time you manually enter the data.

You can go ahead entering the data just like you usually do, and Excel would make sure that your numbers are not changed.

Here is how to do this:

  1. Select the range or rows/column where you would be entering the data
  2. Click the Home tab
Click the Home tab
  1. In the Number group, click on the format drop down
Click on the format drop down
  1. Select Text from the options that show up
Select the Text formatting option

The above steps would change the default formatting of the cells from General to Text.

Now, if you enter any number or any text string in these cells, it would automatically be considered as a text string.

This means that Excel would not automatically change the text you enter (such as truncating the leading zeros or converting entered numbers into dates)

In this example, while I changed the cell formatting first before entering the data, you can also do this with cells that already have data in them.

But remember that if you already had entered numbers that were changed by Excel (such as removing leading zeros or changing text to dates), that won’t come back. You will have to make that data entry again.

Also, keep in mind that cell formatting can change in case you copy and paste some data to these cells. With regular copy-paste, it also copied the formatting from the copied cells. So it’s best to copy and paste values only.

Using the TEXT Function

Excel has an in-built TEXT function that is meant to convert a numeric value to a text value (where you have to specify the format of the text in which you want to get the final result).

This method is useful when you already have a set of numbers and you want to show them in a more readable format or if you want to add some text as suffix or prefix to these numbers.

Suppose you have a set of numbers as shown below, and you want to show all these numbers as five-digit values (which means to add leading zeros to numbers that are less than 5 digits).

Dataset with numbers of different digits

While Excel removes any leading zeros in numbers, you can use the below formula to get this:

=TEXT(A2,"00000")
TEXT formula result

In the above formula, I have used “00000” as the second argument, which tells the formula the format of the output I desire. In this example, 00000 would mean that I need all the numbers to be at least five-digit long.

You can do a lot more with the TEXT function – such as add currency symbol, add prefix or suffix to the numbers, or change the format to have comma or decimals.

Using this method can be useful when you already have the data in Excel and you want to format it in a specific way.

This can also be helpful in saving time when doing manual data entry, where you can quickly enter the data and then use the TEXT function to get it in the desired format.

Using Text to Columns

Another quick way to convert numbers to text in Excel is by using the Text to Columns wizard.

While the purpose of Text to Columns is to split the data into multiple columns, it has a setting that also allows us to quickly select a range of cells and convert all the numbers into text with a few clicks.

Suppose you have a data set is shown below, and you want to convert all the numbers in columns A into text.

Dataset with numbers of different digits

Below are the steps to do this:

  1. Select the numbers in Column A
  2. Click the Data tab
Click the Data tab
  1. Click on the Text to Columns icon in the ribbon. This will open the text to columns wizard this will open the text to column wizard
Click in the Text to Columns icon
  1. In Step 1 of 3, click the Next button
  2. In Step 2 of 3, click the Next button
  3. In Step 3 of 3, under the ‘Column data format’ options, select Text
Select Text option in the Text to Columns Wizard
  1. Click on Finish

The above steps would instantly convert all these numbers in Column A into text. You notice that the numbers would now be aligned to the right (indicating that the cell content is text).  

Numbers converted to text

There would also be a small green triangle at the top left part of the cell, which is a way Excel informs you that there are numbers that are stored as text.

So these are four easy ways that you can use to quickly convert numbers to text in Excel.

In case you only want this for a few cells where you would be manually entering the data, I suggest you use the apostrophe method. If you need to do data entry for more than a few cells, you can try changing the format of the cells from General to Text.

And in case you already have the numbers in Excel and you want to convert them to text, you can use the TEXT formula method or the Text to Columns method I covered in this tutorial.

I hope you found this tutorial useful.

Other Excel tutorials you may also like:

  • Convert Text to Numbers in Excel
  • How to Convert Serial Numbers to Dates in Excel
  • Convert Date to Text in Excel – Explained with Examples
  • How to Convert Formulas to Values in Excel
  • Convert Time to Decimal Number in Excel
  • How to Convert Inches to MM, CM, or Feet in Excel?
  • Convert Scientific Notation to Number or Text in Excel
  • Separate Text and Numbers in Excel

Содержание

  1. Convert numbers stored as text to numbers
  2. 1. Select a column
  3. 2. Click this button
  4. 3. Click Apply
  5. 4. Set the format
  6. Other ways to convert:
  7. 1. Insert a new column
  8. 2. Use the VALUE function
  9. 3. Rest your cursor here
  10. 4. Click and drag down
  11. Fix text-formatted numbers by applying a number format
  12. What do you want to do?
  13. Technique 1: Convert text-formatted numbers by using Error Checking
  14. Technique 2: Convert text-formatted numbers by using Paste Special
  15. Technique 3: Apply a number format to text-formatted numbers
  16. Turn off Error Checking

Convert numbers stored as text to numbers

Numbers that are stored as text can cause unexpected results, like an uncalculated formula showing instead of a result. Most of the time, Excel will recognize this and you’ll see an alert next to the cell where numbers are being stored as text. If you see the alert, select the cells, and then click to choose a convert option.

Check out Format numbers to learn more about formatting numbers and text in Excel.

If the alert button is not available, do the following:

1. Select a column

Select a column with this problem. If you don’t want to convert the whole column, you can select one or more cells instead. Just be sure the cells you select are in the same column, otherwise this process won’t work. (See «Other ways to convert» below if you have this problem in more than one column.)

2. Click this button

The Text to Columns button is typically used for splitting a column, but it can also be used to convert a single column of text to numbers. On the Data tab, click Text to Columns.

3. Click Apply

The rest of the Text to Columns wizard steps are best for splitting a column. Since you’re just converting text in a column, you can click Finish right away, and Excel will convert the cells.

4. Set the format

Press CTRL + 1 (or + 1 on the Mac). Then select any format.

Note: If you still see formulas that are not showing as numeric results, then you may have Show Formulas turned on. Go to the Formulas tab and make sure Show Formulas is turned off.

Other ways to convert:

You can use the VALUE function to return just the numeric value of the text.

1. Insert a new column

Insert a new column next to the cells with text. In this example, column E contains the text stored as numbers. Column F is the new column.

2. Use the VALUE function

In one of the cells of the new column, type =VALUE() and inside the parentheses, type a cell reference that contains text stored as numbers. In this example it’s cell E23.

3. Rest your cursor here

Now you’ll fill the cell’s formula down, into the other cells. If you’ve never done this before, here’s how to do it: Rest your cursor on the lower-right corner of the cell until it changes to a plus sign.

4. Click and drag down

Click and drag down to fill the formula to the other cells. After that’s done, you can use this new column, or you can copy and paste these new values to the original column. Here’s how to do that: Select the cells with the new formula. Press CTRL + C. Click the first cell of the original column. Then on the Home tab, click the arrow below Paste, and then click Paste Special > Values.

If the steps above didn’t work, you can use this method, which can be used if you’re trying to convert more than one column of text.

Select a blank cell that doesn’t have this problem, type the number 1 into it, and then press Enter.

Press CTRL + C to copy the cell.

Select the cells that have numbers stored as text.

On the Home tab, click Paste > Paste Special.

Click Multiply, and then click OK. Excel multiplies each cell by 1, and in doing so, converts the text to numbers.

Press CTRL + 1 (or + 1 on the Mac). Then select any format.

Источник

Fix text-formatted numbers by applying a number format

In some cases, numbers in a worksheet are actually formatted and stored in cells as text, which can cause problems with calculations or produce confusing sort orders. This issue sometimes occurs after you import or copy data from a database or other external data source.

Numbers that are formatted as text are left-aligned instead of right-aligned in the cell, and are often marked with an error indicator.

What do you want to do?

Technique 1: Convert text-formatted numbers by using Error Checking

If you import data into Excel from another source, or if you type numbers into cells that were previously formatted as text, you may see a small green triangle in the upper-left corner of the cell. This error indicator tells you that the number is stored as text, as shown in this example.

If this isn’t what you want, you can follow these steps to convert the number that is stored as text back to a regular number.

On the worksheet, select any single cell or range of cells that has an error indicator in the upper-left corner.

How to select cells, ranges, rows, or columns

Click the cell, or press the arrow keys to move to the cell.

A range of cells

Click the first cell in the range, and then drag to the last cell, or hold down Shift while you press the arrow keys to extend the selection.

You can also select the first cell in the range, and then press F8 to extend the selection by using the arrow keys. To stop extending the selection, press F8 again.

A large range of cells

Click the first cell in the range, and then hold down Shift while you click the last cell in the range. You can scroll to make the last cell visible.

All cells on a worksheet

Click the Select All button.

To select the entire worksheet, you can also press Ctrl+A.

If the worksheet contains data, Ctrl+A selects the current region. Pressing Ctrl+A a second time selects the entire worksheet.

Nonadjacent cells or cell ranges

Select the first cell or range of cells, and then hold down Ctrl while you select the other cells or ranges.

You can also select the first cell or range of cells, and then press Shift+F8 to add another nonadjacent cell or range to the selection. To stop adding cells or ranges to the selection, press Shift+F8 again.

You cannot cancel the selection of a cell or range of cells in a nonadjacent selection without canceling the entire selection.

An entire row or column

Click the row or column heading.

2. Column heading

You can also select cells in a row or column by selecting the first cell and then pressing Ctrl+Shift+Arrow key (Right Arrow or Left Arrow for rows, Up Arrow or Down Arrow for columns).

If the row or column contains data, Ctrl+Shift+Arrow key selects the row or column to the last used cell. Pressing Ctrl+Shift+Arrow key a second time selects the entire row or column.

Adjacent rows or columns

Drag across the row or column headings. Or select the first row or column; then hold down Shift while you select the last row or column.

Nonadjacent rows or columns

Click the column or row heading of the first row or column in your selection; then hold down Ctrl while you click the column or row headings of other rows or columns that you want to add to the selection.

The first or last cell in a row or column

Select a cell in the row or column, and then press Ctrl+Arrow key (Right Arrow or Left Arrow for rows, Up Arrow or Down Arrow for columns).

The first or last cell on a worksheet or in a Microsoft Office Excel table

Press Ctrl+Home to select the first cell on the worksheet or in an Excel list.

Press Ctrl+End to select the last cell on the worksheet or in an Excel list that contains data or formatting.

Cells to the last used cell on the worksheet (lower-right corner)

Select the first cell, and then press Ctrl+Shift+End to extend the selection of cells to the last used cell on the worksheet (lower-right corner).

Cells to the beginning of the worksheet

Select the first cell, and then press Ctrl+Shift+Home to extend the selection of cells to the beginning of the worksheet.

More or fewer cells than the active selection

Hold down Shift while you click the last cell that you want to include in the new selection. The rectangular range between the active cell and the cell that you click becomes the new selection.

To cancel a selection of cells, click any cell on the worksheet.

Next to the selected cell or range of cells, click the error button that appears.

On the menu, click Convert to Number. (If you want to simply get rid of the error indicator without converting the number, click Ignore Error.)

This action converts the numbers that are stored as text back to numbers.

Once you have converted the numbers formatted as text into regular numbers, you can change the way the numbers appear in the cells by applying or customizing a number format. For more information, see Available number formats.

Technique 2: Convert text-formatted numbers by using Paste Special

In this technique, you multiply each selected cell by 1 in order to force the conversion from a text-formatted number to a regular number. Because you’re multiplying the contents of the cell by 1, the result in the cell looks identical. However, Excel actually replaces the text-based contents of the cell with a numerical equivalent.

Select a blank cell and verify that its number format is General.

How to verify the number format

On the Home tab, in the Number group, click the arrow next to the Number Format box, and then click General.

In the cell, type 1, and then press ENTER.

Select the cell, and then press Ctrl+C to copy the value to the Clipboard.

Select the cells or ranges of cells that contain the numbers stored as text that you want to convert.

How to select cells, ranges, rows, or columns

Click the cell, or press the arrow keys to move to the cell.

A range of cells

Click the first cell in the range, and then drag to the last cell, or hold down Shift while you press the arrow keys to extend the selection.

You can also select the first cell in the range, and then press F8 to extend the selection by using the arrow keys. To stop extending the selection, press F8 again.

A large range of cells

Click the first cell in the range, and then hold down Shift while you click the last cell in the range. You can scroll to make the last cell visible.

All cells on a worksheet

Click the Select All button.

To select the entire worksheet, you can also press Ctrl+A.

If the worksheet contains data, Ctrl+A selects the current region. Pressing Ctrl+A a second time selects the entire worksheet.

Nonadjacent cells or cell ranges

Select the first cell or range of cells, and then hold down Ctrl while you select the other cells or ranges.

You can also select the first cell or range of cells, and then press Shift+F8 to add another nonadjacent cell or range to the selection. To stop adding cells or ranges to the selection, press Shift+F8 again.

You cannot cancel the selection of a cell or range of cells in a nonadjacent selection without canceling the entire selection.

An entire row or column

Click the row or column heading.

2. Column heading

You can also select cells in a row or column by selecting the first cell and then pressing Ctrl+Shift+Arrow key (Right Arrow or Left Arrow for rows, Up Arrow or Down Arrow for columns).

If the row or column contains data, Ctrl+Shift+Arrow key selects the row or column to the last used cell. Pressing Ctrl+Shift+Arrow key a second time selects the entire row or column.

Adjacent rows or columns

Drag across the row or column headings. Or select the first row or column; then hold down Shift while you select the last row or column.

Nonadjacent rows or columns

Click the column or row heading of the first row or column in your selection; then hold down Ctrl while you click the column or row headings of other rows or columns that you want to add to the selection.

The first or last cell in a row or column

Select a cell in the row or column, and then press Ctrl+Arrow key (Right Arrow or Left Arrow for rows, Up Arrow or Down Arrow for columns).

The first or last cell on a worksheet or in a Microsoft Office Excel table

Press Ctrl+Home to select the first cell on the worksheet or in an Excel list.

Press Ctrl+End to select the last cell on the worksheet or in an Excel list that contains data or formatting.

Cells to the last used cell on the worksheet (lower-right corner)

Select the first cell, and then press Ctrl+Shift+End to extend the selection of cells to the last used cell on the worksheet (lower-right corner).

Cells to the beginning of the worksheet

Select the first cell, and then press Ctrl+Shift+Home to extend the selection of cells to the beginning of the worksheet.

More or fewer cells than the active selection

Hold down Shift while you click the last cell that you want to include in the new selection. The rectangular range between the active cell and the cell that you click becomes the new selection.

To cancel a selection of cells, click any cell on the worksheet.

On the Home tab, in the Clipboard group, click the arrow below Paste, and then click Paste Special.

Under Operation, select Multiply, and then click OK.

To delete the content of the cell that you typed in step 2 after all numbers have been converted successfully, select that cell, and then press DELETE.

Some accounting programs display negative values as text, with the negative sign ( –) to the right of the value. To convert the text string to a value, you must use a formula to return all the characters of the text string except the rightmost character (the negation sign), and then multiply the result by –1.

For example, if the value in cell A2 is «156–» the following formula converts the text to the value –156.

Technique 3: Apply a number format to text-formatted numbers

In some scenarios, you don’t have to convert numbers stored as text back to numbers, as described earlier in this article. Instead, you can just apply a number format to achieve the same result. For example, if you enter numbers in a workbook, and then format those numbers as text, you won’t see a green error indicator appear in the upper-left corner of the cell. In this case, you can apply number formatting.

Select the cells that contain the numbers that are stored as text.

How to select cells, ranges, rows, or columns

Click the cell, or press the arrow keys to move to the cell.

A range of cells

Click the first cell in the range, and then drag to the last cell, or hold down Shift while you press the arrow keys to extend the selection.

You can also select the first cell in the range, and then press F8 to extend the selection by using the arrow keys. To stop extending the selection, press F8 again.

A large range of cells

Click the first cell in the range, and then hold down Shift while you click the last cell in the range. You can scroll to make the last cell visible.

All cells on a worksheet

Click the Select All button.

To select the entire worksheet, you can also press Ctrl+A.

If the worksheet contains data, Ctrl+A selects the current region. Pressing Ctrl+A a second time selects the entire worksheet.

Nonadjacent cells or cell ranges

Select the first cell or range of cells, and then hold down Ctrl while you select the other cells or ranges.

You can also select the first cell or range of cells, and then press Shift+F8 to add another nonadjacent cell or range to the selection. To stop adding cells or ranges to the selection, press Shift+F8 again.

You cannot cancel the selection of a cell or range of cells in a nonadjacent selection without canceling the entire selection.

An entire row or column

Click the row or column heading.

2. Column heading

You can also select cells in a row or column by selecting the first cell and then pressing Ctrl+Shift+Arrow key (Right Arrow or Left Arrow for rows, Up Arrow or Down Arrow for columns).

If the row or column contains data, Ctrl+Shift+Arrow key selects the row or column to the last used cell. Pressing Ctrl+Shift+Arrow key a second time selects the entire row or column.

Adjacent rows or columns

Drag across the row or column headings. Or select the first row or column; then hold down Shift while you select the last row or column.

Nonadjacent rows or columns

Click the column or row heading of the first row or column in your selection; then hold down Ctrl while you click the column or row headings of other rows or columns that you want to add to the selection.

The first or last cell in a row or column

Select a cell in the row or column, and then press Ctrl+Arrow key (Right Arrow or Left Arrow for rows, Up Arrow or Down Arrow for columns).

The first or last cell on a worksheet or in a Microsoft Office Excel table

Press Ctrl+Home to select the first cell on the worksheet or in an Excel list.

Press Ctrl+End to select the last cell on the worksheet or in an Excel list that contains data or formatting.

Cells to the last used cell on the worksheet (lower-right corner)

Select the first cell, and then press Ctrl+Shift+End to extend the selection of cells to the last used cell on the worksheet (lower-right corner).

Cells to the beginning of the worksheet

Select the first cell, and then press Ctrl+Shift+Home to extend the selection of cells to the beginning of the worksheet.

More or fewer cells than the active selection

Hold down Shift while you click the last cell that you want to include in the new selection. The rectangular range between the active cell and the cell that you click becomes the new selection.

To cancel a selection of cells, click any cell on the worksheet.

On the Home tab, in the Number group, click the Dialog Box Launcher next to Number.

In the Category box, click the number format that you want to use.

For this procedure to complete successfully, make sure that the numbers that are stored as text do not include extra spaces or nonprintable characters in or around the numbers. The extra spaces or characters sometimes occur when you copy or import data from a database or other external source. To remove extra spaces from multiple numbers that are stored as text, you can use the TRIM function or CLEAN function. The TRIM function removes spaces from text except for single spaces between words. The CLEAN function removes all nonprintable characters from text.

Turn off Error Checking

With error checking turned on in Excel, you see a small green triangle if you enter a number into a cell that has text formatting applied to it. If you don’t want to see these error indicators, you can turn them off.

Click the File tab.

Under Help, click Options.

In the Excel Options dialog box, click the Formulas category.

Under Error checking rules, clear the Numbers formatted as text or preceded by an apostrophe check box.

Источник

Содержание

  • Конвертация числа в текстовый вид
    • Способ 1: форматирование через контекстное меню
    • Способ 2: инструменты на ленте
    • Способ 3: использование функции
  • Конвертация текста в число
    • Способ 1: преобразование с помощью значка об ошибке
    • Способ 2: конвертация при помощи окна форматирования
    • Способ 3: конвертация посредством инструментов на ленте
    • Способ 4: применение формулы
    • Способ 5: применение специальной вставки
    • Способ 6: использование инструмента «Текст столбцами»
    • Способ 7: применение макросов
  • Вопросы и ответы

Текст в числа и наоборот в Microsoft Excel

Одной из частых задач, с которыми сталкиваются пользователи программы Эксель, является преобразования числовых выражений в текстовый формат и обратно. Этот вопрос часто заставляет потратить на решение много времени, если юзер не знает четкого алгоритма действий. Давайте разберемся, как можно решить обе задачи различными способами.

Конвертация числа в текстовый вид

Все ячейки в Экселе имеют определенный формат, который задает программе, как ей рассматривать то или иное выражение. Например, даже если в них будут записаны цифры, но формат выставлен текстовый, то приложение будет рассматривать их, как простой текст, и не сможет проводить с такими данными математические вычисления. Для того, чтобы Excel воспринимал цифры именно как число, они должны быть вписаны в элемент листа с общим или числовым форматом.

Для начала рассмотрим различные варианты решения задачи конвертации чисел в текстовый вид.

Способ 1: форматирование через контекстное меню

Чаще всего пользователи выполняют форматирование числовых выражений в текстовые через контекстное меню.

  1. Выделяем те элементы листа, в которых нужно преобразовать данные в текст. Как видим, во вкладке «Главная» на панели инструментов в блоке «Число» в специальном поле отображается информация о том, что данные элементы имеют общий формат, а значит, цифры, вписанные в них, воспринимаются программой, как число.
  2. Общий формат в Microsoft Excel

  3. Кликаем правой кнопкой мыши по выделению и в открывшемся меню выбираем позицию «Формат ячеек…».
  4. Переход в окно форматирования в Microsoft Excel

  5. В открывшемся окне форматирования переходим во вкладку «Число», если оно было открыто в другом месте. В блоке настроек «Числовые форматы» выбираем позицию «Текстовый». Для сохранения изменений жмем на кнопку «OK» в нижней части окна.
  6. Окно форматирования в Microsoft Excel

  7. Как видим, после данных манипуляций в специальном поле высвечивается информация о том, что ячейки были преобразованы в текстовый вид.
  8. Ячейки преобоазованы в текстовый формат в Microsoft Excel

  9. Но если мы попытаемся подсчитать автосумму, то она отобразится в ячейке ниже. Это означает, что преобразование было совершено не полностью. В этом и заключается одна из фишек Excel. Программа не дает завершить преобразование данных наиболее интуитивно понятным способом.
  10. Автосумма в Microsoft Excel

  11. Чтобы завершить преобразование, нам нужно последовательно двойным щелчком левой кнопки мыши поместить курсор в каждый элемент диапазона в отдельности и нажать на клавишу Enter. Чтобы упростить задачу вместо двойного щелчка можно использовать нажатие функциональной клавиши F2.
  12. Преобразование числа в текст в Microsoft Excel

  13. После выполнения данной процедуры со всеми ячейками области, данные в них будут восприниматься программой, как текстовые выражения, а, следовательно, и автосумма будет равна нулю. Кроме того, как видим, левый верхний угол ячеек будет окрашен в зеленый цвет. Это также является косвенным признаком того, что элементы, в которых находятся цифры, преобразованы в текстовый вариант отображения. Хотя этот признак не всегда является обязательным и в некоторых случаях такая пометка отсутствует.

Автосумма равна 0 в Microsoft Excel

Урок: Как изменить формат в Excel

Способ 2: инструменты на ленте

Преобразовать число в текстовый вид можно также воспользовавшись инструментами на ленте, в частности, использовав поле для показа формата, о котором шел разговор выше.

  1. Выделяем элементы, данные в которых нужно преобразовать в текстовый вид. Находясь во вкладке «Главная» кликаем по пиктограмме в виде треугольника справа от поля, в котором отображается формат. Оно расположено в блоке инструментов «Число».
  2. Переход к форматированию на ленте в Microsoft Excel

    Lumpics.ru

  3. В открывшемся перечне вариантов форматирования выбираем пункт «Текстовый».
  4. Выбор текстового формата в Microsoft Excel

  5. Далее, как и в предыдущем способе, последовательно устанавливаем курсор в каждый элемент диапазона двойным щелчком левой кнопки мыши или нажатием клавиши F2, а затем щелкаем по клавише Enter.

Данные преобразовываются в текстовый вариант.

Способ 3: использование функции

Ещё одним вариантом преобразования числовых данных в тестовые в Экселе является применение специальной функции, которая так и называется – ТЕКСТ. Данный способ подойдёт, в первую очередь, если вы хотите перенести числа как текст в отдельный столбец. Кроме того, он позволит сэкономить время на преобразовании, если объем данных слишком большой. Ведь, согласитесь, что перещелкивать каждую ячейку в диапазоне, насчитывающем сотни или тысячи строк – это не самый лучший выход.

  1. Устанавливаем курсор в первый элемент диапазона, в котором будет выводиться результат преобразования. Щелкаем по значку «Вставить функцию», который размещен около строки формул.
  2. Переход в Мастер функций в Microsoft Excel

  3. Запускается окно Мастера функций. В категории «Текстовые» выделяем пункт «ТЕКСТ». После этого кликаем по кнопке «OK».
  4. Переход к аргументам функции ТЕКСТ в Microsoft Excel

  5. Открывается окно аргументов оператора ТЕКСТ. Данная функция имеет следующий синтаксис:

    =ТЕКСТ(значение;формат)

    Открывшееся окно имеет два поля, которые соответствуют данным аргументам: «Значение» и «Формат».

    В поле «Значение» нужно указать преобразовываемое число или ссылку на ячейку, в которой оно находится. В нашем случае это будет ссылка на первый элемент обрабатываемого числового диапазона.

    В поле «Формат» нужно указать вариант отображения результата. Например, если мы введем «0», то текстовый вариант на выходе будет отображаться без десятичных знаков, даже если в исходнике они были. Если мы внесем «0,0», то результат будет отображаться с одним десятичным знаком, если «0,00», то с двумя, и т.д.

    После того, как все требуемые параметры введены, щелкаем по кнопке «OK».

  6. Аргументы функции ТЕКСТ в Microsoft Excel

  7. Как видим, значение первого элемента заданного диапазона отобразилось в ячейке, которую мы выделили ещё в первом пункте данного руководства. Для того, чтобы перенести и другие значения, нужно скопировать формулу в смежные элементы листа. Устанавливаем курсор в нижний правый угол элемента, который содержит формулу. Курсор преобразуется в маркер заполнения, имеющий вид небольшого крестика. Зажимаем левую кнопку мыши и протаскиваем по пустым ячейкам параллельно диапазону, в котором находятся исходные данные.
  8. Маркер заполнения в Microsoft Excel

  9. Теперь весь ряд заполнен требуемыми данными. Но и это ещё не все. По сути, все элементы нового диапазона содержат в себе формулы. Выделяем эту область и жмем на значок «Копировать», который расположен во вкладке «Главная» на ленте инструментов группе «Буфер обмена».
  10. Копирование в Microsoft Excel

  11. Далее, если мы хотим сохранить оба диапазона (исходный и преобразованный), не снимаем выделение с области, которая содержит формулы. Кликаем по ней правой кнопкой мыши. Происходит запуск контекстного списка действий. Выбираем в нем позицию «Специальная вставка». Среди вариантов действий в открывшемся списке выбираем «Значения и форматы чисел».
    Специальная вставка в Microsoft Excel

    Если же пользователь желает заменить данные исходного формата, то вместо указанного действия нужно выделить именно его и произвести вставку тем же способом, который указан выше.

  12. Специальная вставка в исходный диапазон в Microsoft Excel

  13. В любом случае, в выбранный диапазон будут вставлены данные в текстовом виде. Если же вы все-таки выбрали вставку в исходную область, то ячейки, содержащие формулы, можно очистить. Для этого выделяем их, кликаем правой кнопкой мыши и выбираем позицию «Очистить содержимое».

Очистка содержимого в Microsoft Excel

На этом процедуру преобразования можно считать оконченной.

Урок: Мастер функций в Excel

Конвертация текста в число

Теперь давайте разберемся, какими способами можно выполнить обратную задачу, а именно как преобразовать текст в число в Excel.

Способ 1: преобразование с помощью значка об ошибке

Проще и быстрее всего выполнить конвертацию текстового варианта с помощью специального значка, который сообщает об ошибке. Этот значок имеет вид восклицательного знака, вписанного в пиктограмму в виде ромба. Он появляется при выделении ячеек, которые имеют пометку в левом верхнем углу зеленым цветом, обсуждаемую нами ранее. Эта пометка ещё не свидетельствует о том, что данные находящиеся в ячейке обязательно ошибочные. Но цифры, расположенные в ячейке имеющей текстовый вид, вызывают подозрения у программы в том, что данные могут быть внесены некорректно. Поэтому на всякий случай она их помечает, чтобы пользователь обратил внимание. Но, к сожалению, такие пометки Эксель выдает не всегда даже тогда, когда цифры представлены в текстовом виде, поэтому ниже описанный способ подходит не для всех случаев.

  1. Выделяем ячейку, в которой содержится зеленый индикатор о возможной ошибке. Кликаем по появившейся пиктограмме.
  2. Значок об ошибке в Microsoft Excel

  3. Открывается список действий. Выбираем в нем значение «Преобразовать в число».
  4. Преобразование в число в Microsoft Excel

  5. В выделенном элементе данные тут же будут преобразованы в числовой вид.

Значение в ячейке преобразовано в число в Microsoft Excel

Если подобных текстовых значений, которые следует преобразовать, не одно, а множество, то в этом случае можно ускорить процедуру преобразования.

  1. Выделяем весь диапазон, в котором находятся текстовые данные. Как видим, пиктограмма появилась одна для всей области, а не для каждой ячейки в отдельности. Щелкаем по ней.
  2. Пиктограмма для диапазона в Microsoft Excel

  3. Открывается уже знакомый нам список. Как и в прошлый раз, выбираем позицию «Преобразовать в число».

преобразование в число диапазона в Microsoft Excel

Все данные массива будут преобразованы в указанный вид.

Преобразование в число выполнено в Microsoft Excel

Способ 2: конвертация при помощи окна форматирования

Как и для преобразования данных из числового вида в текст, в Экселе существует возможность обратного конвертирования через окно форматирования.

  1. Выделяем диапазон, содержащий цифры в текстовом варианте. Кликаем правой кнопкой мыши. В контекстном меню выбираем позицию «Формат ячеек…».
  2. Переход к окну форматирования в Microsoft Excel

  3. Выполняется запуск окна форматирования. Как и в предыдущий раз, переходим во вкладку «Число». В группе «Числовые форматы» нам нужно выбрать значения, которые позволят преобразовать текст в число. К ним относится пункты «Общий» и «Числовой». Какой бы из них вы не выбрали, программа будет расценивать цифры, введенные в ячейку, как числа. Производим выбор и жмем на кнопку. Если вы выбрали значение «Числовой», то в правой части окна появится возможность отрегулировать представление числа: выставить количество десятичных знаков после запятой, установить разделителями между разрядами. После того, как настройка выполнена, жмем на кнопку «OK».
  4. Окно форматирования в программе Microsoft Excel

  5. Теперь, как и в случае преобразования числа в текст, нам нужно прощелкать все ячейки, установив в каждую из них курсор и нажав после этого клавишу Enter.

Прощелкивание ячеек в Microsoft Excel

После выполнения этих действий все значения выбранного диапазона преобразуются в нужный нам вид.

Способ 3: конвертация посредством инструментов на ленте

Перевести текстовые данные в числовые можно, воспользовавшись специальным полем на ленте инструментов.

  1. Выделяем диапазон, который должен подвергнуться трансформации. Переходим во вкладку «Главная» на ленте. Кликаем по полю с выбором формата в группе «Число». Выбираем пункт «Числовой» или «Общий».
  2. Форматирование текстового формата в числовой через ленту в Microsoft Excel

  3. Далее прощелкиваем уже не раз описанным нами способом каждую ячейку преобразуемой области с применением клавиш F2 и Enter.

Прощелкивание для трансформации в числовой формат в Microsoft Excel

Значения в диапазоне будут преобразованы из текстовых в числовые.

Способ 4: применение формулы

Также для преобразования текстовых значений в числовые можно использовать специальные формулы. Рассмотрим, как это сделать на практике.

  1. В пустой ячейке, расположенной параллельно первому элементу диапазона, который следует преобразовать, ставим знак «равно» (=) и двойной символ «минус» (—). Далее указываем адрес первого элемента трансформируемого диапазона. Таким образом, происходит двойное умножение на значение «-1». Как известно, умножение «минус» на «минус» дает «плюс». То есть, в целевой ячейке мы получаем то же значение, которое было изначально, но уже в числовом виде. Даная процедура называется двойным бинарным отрицанием.
  2. Формула в Microsoft Excel

  3. Жмем на клавишу Enter, после чего получаем готовое преобразованное значение. Для того, чтобы применить данную формулу для всех других ячеек диапазона, используем маркер заполнения, который ранее был применен нами для функции ТЕКСТ.
  4. Маркер заполнения для формулы двойного бинарного отрицания в Microsoft Excel

  5. Теперь мы имеем диапазон, который заполнен значениями с формулами. Выделяем его и жмем на кнопку «Копировать» во вкладке «Главная» или применяем сочетание клавиш Ctrl+C.
  6. Коопирование числовых значений в Microsoft Excel

  7. Выделяем исходную область и производим щелчок по ней правой кнопкой мыши. В активировавшемся контекстном списке переходим по пунктам «Специальная вставка» и «Значения и форматы чисел».
  8.  Применение специальной вставки в Microsoft Excel

  9. Все данные вставлены в нужном нам виде. Теперь можно удалить транзитный диапазон, в котором находится формула двойного бинарного отрицания. Для этого выделяем данную область, кликом правой кнопки мыши вызываем контекстное меню и выбираем в нем позицию «Очистить содержимое».

Очистка содержимого транзитного диапазона в Microsoft Excel

Кстати, для преобразования значений данным методом совсем не обязательно использовать исключительно двойное умножение на «-1». Можно применять любое другое арифметическое действие, которое не ведет к изменению значений (сложение или вычитание нуля, выполнение возведения в первую степень и т.д.)

Урок: Как сделать автозаполнение в Excel

Способ 5: применение специальной вставки

Следующий способ по принципу действия очень похож на предыдущий с той лишь разницей, что для его использования не нужно создавать дополнительный столбец.

  1. В любую пустую ячейку на листе вписываем цифру «1». Затем выделяем её и жмем на знакомый значок «Копировать» на ленте.
  2. Копирование цифры 1 в Microsoft Excel

  3. Выделяем область на листе, которую следует преобразовать. Кликаем по ней правой кнопкой мыши. В открывшемся меню дважды переходим по пункту «Специальная вставка».
  4. Переход в специальную вставку в Microsoft Excel

  5. В окне специальной вставки выставляем переключатель в блоке «Операция» в позицию «Умножить». Вслед за этим жмем на кнопку «OK».
  6. Специальная вставка в программе Microsoft Excel

  7. После этого действия все значения выделенной области будут преобразованы в числовые. Теперь при желании можно удалить цифру «1», которую мы использовали в целях конвертации.

Диапазон преобразован в число в помощью специальной вставки в Microsoft Excel

Способ 6: использование инструмента «Текст столбцами»

Ещё одним вариантом, при котором можно преобразовать текст в числовой вид, является применение инструмента «Текст столбцами». Его есть смысл использовать тогда, когда вместо запятой в качестве разделителя десятичных знаков используется точка, а в качестве разделителя разрядов вместо пробела – апостроф. Этот вариант воспринимается в англоязычном Экселе, как числовой, но в русскоязычной версии этой программы все значения, которые содержат указанные выше знаки, воспринимаются как текст. Конечно, можно перебить данные вручную, но если их много, это займет значительное количество времени, тем более что существует возможность гораздо более быстрого решения проблемы.

  1. Выделяем фрагмент листа, содержимое которого нужно преобразовать. Переходим во вкладку «Данные». На ленте инструментов в блоке «Работа с данными» кликаем по значку «Текст по столбцам».
  2. Переход к инструменту Текст по столбцам в Microsoft Excel

  3. Запускается Мастер текстов. В первом окне обратите внимание, чтобы переключатель формата данных стоял в позиции «С разделителями». По умолчанию он должен находиться в этой позиции, но проверить состояние будет не лишним. Затем кликаем по кнопке «Далее».
  4. Первое окно Мастера текстов в Microsoft Excel

  5. Во втором окне также оставляем все без изменений и жмем на кнопку «Далее».
  6. Второе окно Мастера текстов в Microsoft Excel

  7. А вот после открытия третьего окна Мастера текстов нужно нажать на кнопку «Подробнее».
  8. Третье окно Мастера текстов в Microsoft Excel

  9. Открывается окно дополнительной настройки импорта текста. В поле «Разделитель целой и дробной части» устанавливаем точку, а в поле «Разделитель разрядов» — апостроф. Затем делаем один щелчок по кнопке «OK».
  10. Дополнительная настройка импорта текста в Microsoft Excel

  11. Возвращаемся в третье окно Мастера текстов и жмем на кнопку «Готово».
  12. Завершение работы в Мастере текста в Microsoft Excel

  13. Как видим, после выполнения данных действий числа приняли привычный для русскоязычной версии формат, а это значит, что они одновременно были преобразованы из текстовых данных в числовые.

Разделители приняли обычный формат в Microsoft Excel

Способ 7: применение макросов

Если вам часто приходится преобразовывать большие области данных из текстового формата в числовой, то имеется смысл в этих целях записать специальный макрос, который будет использоваться при необходимости. Но для того, чтобы это выполнить, прежде всего, нужно в своей версии Экселя включить макросы и панель разработчика, если это до сих пор не сделано.

  1. Переходим во вкладку «Разработчик». Жмем на значок на ленте «Visual Basic», который размещен в группе «Код».
  2. Переход в редактор макросов в Microsoft Excel

  3. Запускается стандартный редактор макросов. Вбиваем или копируем в него следующее выражение:


    Sub Текст_в_число()
    Selection.NumberFormat = "General"
    Selection.Value = Selection.Value
    End Sub

    После этого закрываем редактор, выполнив нажатие стандартной кнопки закрытия в верхнем правом углу окна.

  4. Редактор макросов в Microsoft Excel

  5. Выделяем фрагмент на листе, который нужно преобразовать. Жмем на значок «Макросы», который расположен на вкладке «Разработчик» в группе «Код».
  6. Переход к списку макросов в Microsoft Excel

  7. Открывается окно записанных в вашей версии программы макросов. Находим макрос с наименованием «Текст_в_число», выделяем его и жмем на кнопку «Выполнить».
  8. Окно макросов в Microsoft Excel

  9. Как видим, тут же происходит преобразование текстового выражения в числовой формат.

Преобразование текста в число с помощью макросов выполнено в Microsoft Excel

Урок: Как создать макрос в Экселе

Как видим, существует довольно много вариантов преобразования в Excel цифр, которые записаны в числовом варианте, в текстовый формат и в обратном направлении. Выбор определенного способа зависит от многих факторов. Прежде всего, это поставленная задача. Ведь, например, быстро преобразовать текстовое выражение с иностранными разделителями в числовое можно только использовав инструмент «Текст столбцами». Второй фактор, который влияет на выбор варианта – это объемы и частота выполняемых преобразований. Например, если вы часто используете подобные преобразования, имеет смысл произвести запись макроса. И третий фактор – индивидуальное удобство пользователя.

Понравилась статья? Поделить с друзьями:
  • Excel numberformat vba numberformat
  • Excel number value formula
  • Excel number to hex
  • Excel number of years
  • Excel number of selected rows