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 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.
Related topics
Replace a formula with its result
Top ten ways to clean your data
CLEAN function
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.
It’s common to find numbers stored as text in Excel. This leads to incorrect calculations when you use these cells in Excel functions such as SUM and AVERAGE (as these functions ignore cells that have text values in it). In such cases, you need to convert cells that contain numbers as text back to numbers.
Now before we move forward, let’s first look at a few reasons why you may end up with a workbook that has numbers stored as text.
- Using ‘ (apostrophe) before a number.
- A lot of people enter apostrophe before a number to make it text. Sometimes, it’s also the case when you download data from a database. While this makes the numbers show up without the apostrophe, it impacts the cell by forcing it to treat the numbers as text.
- Getting numbers as a result of a formula (such as LEFT, RIGHT, or MID)
- If you extract the numerical part of a text string (or even a part of a number) using the TEXT functions, the result is a number in the text format.
Now, let’s see how to tackle such cases.
Convert Text to Numbers in Excel
In this tutorial, you’ll learn how to convert text to numbers in Excel.
The method you need to use depends on how the number has been converted into text. Here are the ones that are covered in this tutorial.
- Using the ‘Convert to Number’ option.
- Change the format from Text to General/Number.
- Using Paste Special.
- Using Text to Columns.
- Using a Combination of VALUE, TRIM, and CLEAN function.
Convert Text to Numbers Using ‘Convert to Number’ Option
When an apostrophe is added to a number, it changes the number format to text format. In such cases, you’ll notice that there is a green triangle at the top left part of the cell.
In this case, you can easily convert numbers to text by following these steps:
- Select all the cells that you want to convert from text to numbers.
- Click on the yellow diamond shape icon that appears at the top right. From the menu that appears, select ‘Convert to Number’ option.
This would instantly convert all the numbers stored as text back to numbers. You would notice that the numbers get aligned to the right after the conversion (while these were aligned to the left when stored as text).
Convert Text to Numbers by Changing Cell Format
When the numbers are formatted as text, you can easily convert it back to numbers by changing the format of the cells.
Here are the steps:
- Select all the cells that you want to convert from text to numbers.
- Go to Home –> Number. In the Number Format drop-down, select General.
This would instantly change the format of the selected cells to General and the numbers would get aligned to the right. If you want, you can select any of the other formats (such as Number, Currency, Accounting) which will also lead to the value in cells being considered as numbers.
Also read: How to Convert Serial Numbers to Dates in Excel
Convert Text to Numbers Using Paste Special Option
To convert text to numbers using Paste Special option:
Convert Text to Numbers Using Text to Column
This method is suitable in cases where you have the data in a single column.
Here are the steps:
- Select all the cells that you want to convert from text to numbers.
- Go to Data –> Data Tools –> Text to Columns.
- In the Text to Column Wizard:
While you may still find the resulting cells to be in the text format, and the numbers still aligned to the left, now it would work in functions such as SUM and AVERAGE.
Convert Text to Numbers Using the VALUE Function
You can use a combination of VALUE, TRIM and CLEAN function to convert text to numbers.
- VALUE function converts any text that represents a number back to a number.
- TRIM function removes any leading or trailing spaces.
- CLEAN function removes extra spaces and non-printing characters that might sneak in if you import the data or download from a database.
Suppose you want convert cell A1 from text to numbers, here is the formula:
=VALUE(TRIM(CLEAN(A1)))
If you want to apply this to other cells as well, you can copy and use the formula.
Finally, you can convert the formula to value using paste special.
You May Also Like the Following Excel Tutorials:
- Multiply in Excel Using Paste Special.
- How to Convert Text to Date in Excel (8 Easy Ways)
- How to Convert Numbers to Text in Excel
- Convert Formula to Values Using Paste Special.
- Excel Custom Number Formatting.
- Convert Time to Decimal Number in Excel
- Change Negative Number to Positive in Excel
- How to Capitalize First Letter of a Text String in Excel
- Convert Scientific Notation to Number or Text in Excel
- How To Convert Date To Serial Number In Excel?
Преобразование чисел-как-текст в нормальные числа
Если для каких-либо ячеек на листе был установлен текстовый формат (это мог сделать пользователь или программа при выгрузке данных в Excel), то введенные потом в эти ячейки числа Excel начинает считать текстом. Иногда такие ячейки помечаются зеленым индикатором, который вы, скорее всего, видели:
Причем иногда такой индикатор не появляется (что гораздо хуже).
В общем и целом, появление в ваших данных чисел-как-текст обычно приводит к большому количеству весьма печальных последствий:
Особенно забавно, что естественное желание просто изменить формат ячейки на числовой — не помогает. Т.е. вы, буквально, выделяете ячейки, щелкаете по ним правой кнопкой мыши, выбираете Формат ячеек (Format Cells), меняете формат на Числовой (Number), жмете ОК — и ничего не происходит! Совсем!
Возможно, «это не баг, а фича», конечно, но нам от этого не легче. Так что давайте-к рассмотрим несколько способов исправить ситуацию — один из них вам обязательно поможет.
Способ 1. Зеленый уголок-индикатор
Если на ячейке с числом с текстовом формате вы видите зеленый уголок-индикатор, то считайте, что вам повезло. Можно просто выделить все ячейки с данными и нажать на всплывающий желтый значок с восклицательным знаком, а затем выбрать команду Преобразовать в число (Convert to number):
Все числа в выделенном диапазоне будут преобразованы в полноценные.
Если зеленых уголков нет совсем, то проверьте — не выключены ли они в настройках вашего Excel (Файл — Параметры — Формулы — Числа, отформатированные как текст или с предшествующим апострофом).
Способ 2. Повторный ввод
Если ячеек немного, то можно поменять их формат на числовой, а затем повторно ввести данные, чтобы изменение формата вступило-таки в силу. Проще всего это сделать, встав на ячейку и нажав последовательно клавиши F2 (вход в режим редактирования, в ячейке начинает мигаеть курсор) и затем Enter. Также вместо F2 можно просто делать двойной щелчок левой кнопкой мыши по ячейке.
Само-собой, что если ячеек много, то такой способ, конечно, не подойдет.
Способ 3. Формула
Можно быстро преобразовать псевдочисла в нормальные, если сделать рядом с данными дополнительный столбец с элементарной формулой:
Двойной минус, в данном случае, означает, на самом деле, умножение на -1 два раза. Минус на минус даст плюс и значение в ячейке это не изменит, но сам факт выполнения математической операции переключает формат данных на нужный нам числовой.
Само-собой, вместо умножения на 1 можно использовать любую другую безобидную математическую операцию: деление на 1 или прибавление-вычитание нуля. Эффект будет тот же.
Способ 4. Специальная вставка
Этот способ использовали еще в старых версиях Excel, когда современные эффективные менеджеры под стол ходили зеленого уголка-индикатора еще не было в принципе (он появился только с 2003 года). Алгоритм такой:
- в любую пустую ячейку введите 1
- скопируйте ее
- выделите ячейки с числами в текстовом формате и поменяйте у них формат на числовой (ничего не произойдет)
- щелкните по ячейкам с псевдочислами правой кнопкой мыши и выберите команду Специальная вставка (Paste Special) или используйте сочетание клавиш Ctrl+Alt+V
- в открывшемся окне выберите вариант Значения (Values) и Умножить (Multiply)
По-сути, мы выполняем то же самое, что и в прошлом способе — умножение содержимого ячеек на единицу — но не формулами, а напрямую из буфера.
Способ 5. Текст по столбцам
Если псеводчисла, которые надо преобразовать, вдобавок еще и записаны с неправильными разделителями целой и дробной части или тысяч, то можно использовать другой подход. Выделите исходный диапазон с данными и нажмите кнопку Текст по столбцам (Text to columns) на вкладке Данные (Data). На самом деле этот инструмент предназначен для деления слипшегося текста по столбцам, но, в данном случае, мы используем его с другой целью.
Пропустите первых два шага нажатием на кнопку Далее (Next), а на третьем воспользуйтесь кнопкой Дополнительно (Advanced). Откроется диалоговое окно, где можно задать имеющиеся сейчас в нашем тексте символы-разделители:
После нажатия на Готово Excel преобразует наш текст в нормальные числа.
Способ 6. Макрос
Если подобные преобразования вам приходится делать часто, то имеет смысл автоматизировать этот процесс при помощи несложного макроса. Нажмите сочетание клавиш Alt+F11 или откройте вкладку Разработчик (Developer) и нажмите кнопку Visual Basic. В появившемся окне редактора добавьте новый модуль через меню Insert — Module и скопируйте туда следующий код:
Sub Convert_Text_to_Numbers() Selection.NumberFormat = "General" Selection.Value = Selection.Value End Sub
Теперь после выделения диапазона всегда можно открыть вкладку Разрабочик — Макросы (Developer — Macros), выбрать наш макрос в списке, нажать кнопку Выполнить (Run) — и моментально преобразовать псевдочисла в полноценные.
Также можно добавить этот макрос в личную книгу макросов, чтобы использовать позднее в любом файле.
P.S.
С датами бывает та же история. Некоторые даты тоже могут распознаваться Excel’ем как текст, поэтому не будет работать группировка и сортировка. Решения — те же самые, что и для чисел, только формат вместо числового нужно заменить на дату-время.
Ссылки по теме
- Деление слипшегося текста по столбцам
- Вычисления без формул специальной вставкой
- Преобразование текста в числа с помощью надстройки PLEX
You are changing the cell format, for example from “text” to “number” and nothing happens? Or the other way around, you want to enter a phone number but Excel automatically converts it to a number? Unfortunately, Excel is very unpredictable when it comes to text/number formatting. Here is what you should do in order to force Excel to accept your desired format.
Three methods of forcing a TEXT cell TO a NUMBER format
Sometimes, Excel recognizes a cell with a number value in it as text. You will notice that when you conduct calculations: you will receive a #VALUE! error. This problem can be quite annoying because some cells can be very persistent. In this article we will explore ways of how to force a text cell to the number format.
There are basically three approaches for forcing a cell to the number format. Doing it manually, multiplying by 1 or if that doesn’t work using additional tools.
Method 1: Force to number manually
In many cases it’s enough if you enter the cell for editing it and confirm by pressing enter on the keyboard.
- First: Make sure that the cell is formatted as number. Therefore press Ctrl + 1 on the keyboard and set the “Category” on the “Number” tab to “Number.
- Now enter the cell by pressing F2 on the keyboard.
- Then press enter .
Is the cell a number cell now?
Method 2: Force to number by multiplying with 1
Luckily, if you are converting a text format to a number format, there is an easy workaround:
- Change the format of the cell to “Number” by pressing Ctrl +1 (Mac: Cmd + 1) and select number in the “Number”-tab. Confirm by pressing Enter on the keyboard or clicking OK.
- Write “1” into an empty cell.
- Copy this cell.
- Select the cells you want to force to the number format.
- “Paste Special” by press Ctrl + Alt + v (Mac: Ctrl + Cmd + v).
- At the now opened paste special window select “Multiply”. If you don’t want other changes as background/font color, you might want to select “Value” as well.
- Press “OK”.
Now Excel is forced to do a multiplication and therefore has to change the cell format to number. If it doesn’t work, you might want check, if there are any “not number format-able” characters in your cells, a space or a ‘ for example.
One more tip: This also works within formulas. If your cell is as text, just multiply it by one in a formula. E.g.=A1*1
Method 3: Force to number with ‘Professor Excel Tools’
You want a more convenient way? The Excel add-in ‘Professor Excel Tools‘ provides a feature called ‘Force to Number’: It is a powerful tool for converting a text cell to number by executing several steps.
Just select your cell which you want to convert to a number value and click on the ‘Force to Number’ button in the center of the Quick Cell Functions group. Please feel free to download the free trial version on the button below.
This function is included in our Excel Add-In ‘Professor Excel Tools’
(No sign-up, download starts directly)
Three Methods of forcing a NUMBER cell TO a TEXT format
Sometimes, you don’t want Excel to automatically convert a text to a number, for example, when you type a phone number which starts with “0”. If Excel converts it to a number, the 0 in the beginning will be deleted.
We’ve already seen the worst case if Excel misunderstands a formatting. In our example, the MI5 bugged the wrong phones because the phone number in their Excel spreadsheet had some formatting issues.
There are two different ways to avoid Excel converting characters to a number.
Method 1: Just switch the format to text
Format the cell to text by pressing Ctrl + 1 . Please note that sometimes Excel automatically switches back to number.
Method 2: Add an ‘ (apostrophe)
The more reliable way is to force a number cell to text is to put an ‘ (apostrophe) at the beginning of your text (or in our case the phone number). Let’s say, you want to type the phone number 004912345678. In order to preserve the 00 in the beginning, type it like this: ‘004912345678
Method 3: Force to Text with Professor Excel Tools
If you want to bulk insert the single quotation marks to many cells, you can use our Excel add-in Professor Excel Tools. Just select all your cells, go to the Professor Excel ribbon and click on “Force to Text”.
This function is included in our Excel Add-In ‘Professor Excel Tools’
(No sign-up, download starts directly)
Forcing any other cell format conversion by using VBA
For all other conversions, e.g. a zip-code, the fastest way is probably a short VBA code. This way might be a little bit tricky, but if you stay with the following recipe, it shouldn’t be a problem:
- Select all the cells you want to change the format.
- Change the format the cell to “Number” by pressing Ctrl +1 at the same time and select your desired cell format under the “Number”-tab.
- Make sure, that your cells are still selected.
- Press Alt + F11 for opening the VBA editor.
- Press Ctrl + G for opening the “Immediate”-Window.
- Paste the following code and press enter .
For Each cl In Selection:cl.Formula=cl.Formula:Next cl
Note: This way works also for converting a text cell to number.
It is quite a frustrating situation when the numbers are formatted or stored as text in an Excel spreadsheet. Due to this, you’ll be unable to perform various Excel tasks like creating charts from values, mathematical calculations, or grouping them into arrays. But don’t worry, in this write-up, you’ll learn how to convert text to number in Excel using 6 different ways.
So, without any further ado, let’s get started…
Follow the below step-by-step methods for converting text to numerical values in MS Excel.
- Use the ‘Convert to Number’ Option
- Use Paste Special with Multiply
- Use the ‘Text to Columns’
- How to Convert the Text to Number with the VALUE Function
- Excel Convert Text To Number Using VBA
- Changing Cell Format
Way 1: Use the ‘Convert to Number’ Option to Convert Text to Number Excel
The very first way that you can try to convert text to number using the option ‘Convert to Number’. This option will eventually help you to convert the data that is been entered in the Excel with an apostrophe.
Here is how you can use this option:
- Initially, select the Excel cells that you need to convert to the number format.
- Then, you’ll see one yellow diamond exclamation symbol near the selection.
- Simply, click on a dropdown >> select the option ‘Convert to Number’.
- Now, you will be getting your text converted to the number.
Way 2: Use Paste Special with Multiply
In Microsoft Excel, Paste Special is a fabulous tool that also helps to convert text to numbers in Excel.
So, here we will use the Paste Special feature to convert the text into numbers and to perform the simple calculation.
Here is how you can do so:
- Enter the value 1, in any blank cell.
- After that select, the particular cell where you type 1 > on the Edit menu. Click Copy.
- And with the values select the cells that you need to convert to numbers.
- Next on Edit menu >> click Paste Special.
- Then under Paste Special operation >> select All >> click Multiply >> OK.
Note: If you are getting any issues while pasting your data in the Excel worksheet, check out this post.
Way 3: Use the ‘Text to Columns’
This method works best if data is arranged in a single column. The example presumes that the data is in column A and starts in row 1 ($A$1).
Follow the steps to do so:
- Choose one column of cells that holds the text.
- And on the Data menu > click Text to Columns.
- After that under Original data type > click Delimited > click Next.
- Next under Delimiters > click to choose the Tab check box > click Next.
- And under Column data format > click General.
- Then click Advanced > make any appropriate settings for the Decimal separator > Thousands separator and click OK.
- Click Finish.
And that all your text is converted to numbers.
Way 4: How to Convert Text to Number in Excel with the VALUE Function
The VALUE function is a handy way that can be used for converting the text to numbers.
Here you have to type the below command in the cell:
= VALUE (text)
- Here, text is the value that you need to convert to a numerical value.
In case, if your text contains non-numerical characters, the VALUE function returns a #VALUE! error. And it doesn’t give you the result that you want.
= VALUE (B3)
Now, the above formula can be used to convert text in the Excel cell B3 to a numerical value and then copy & paste a formula in order to convert the complete column.
Way 5: Excel Convert Text To Number Using VBA
Another very interesting way to make your Convert Text to Numerical values is by using the VBA code. It is well applicable to Excel 2003/2007 application version.
It is found that in many cases all the above-mentioned solution fails to work. Well in a such situation, using VBA works great.
The following VBA Macro code is provided on the Microsoft page to make Excel convert Text to Number.
Sub Enter_Values()
For Each xCell In Selection
xCell.Value = xCell.Value
Next xCell
End Sub
If in case the above VBA code shows an error on execution, then you need to do the following changes in coding:
For Each xCell In Selection
xCell.Value = CDec(xCell.Value)
Next xCell
Way 6: Changing Cell Format
Changing the cell format is another yet way that can assist you to convert text to number Excel successfully.
- For this, you have to right-click on the cell(s).
- Click on “Format Cells.”
- After this, choose “Number” tab >> click on “Number” on a left.
- Now, you can adjust the Decimal Places >> click “OK.”
Related FAQs:
What Is the Shortcut to Convert to Number in Excel?
The Ctrl + Alt + V is the shortcut to convert to numbers. All you need to do is to select the cells that you need to convert to numbers, then press the Ctrl + Alt + V keys simultaneously.
How Do I Convert Text to Number in Excel VLOOKUP?
By using the Value Function, you can convert the text to number in Excel VLOOKUP.
How Do I Convert Text to Number in Excel Cell?
You can convert text to number in Excel cell using the Paste Special feature, error checking, or Value Function.
Also Read: How to Convert Access To Excel File? [The Definitive Guide]
To Sum Up
Well, this is all about how to convert text to number in Excel in easy ways. I tried my level best to put together the possible steps that will help you out.
All you need to do is to follow the given steps one by one and convert text to number in MS Excel effortlessly.
Thanks for reading this post!
Priyanka is an entrepreneur & content marketing expert. She writes tech blogs and has expertise in MS Office, Excel, and other tech subjects. Her distinctive art of presenting tech information in the easy-to-understand language is very impressive. When not writing, she loves unplanned travels.