Excel do not convert to number

Symptoms

When you try to format a cell as a number in Microsoft Excel, the cell remains formatted as text.

Cause

This issue occurs when the following conditions are true:

  • In the Format Cells dialog box, you format a cell as text.

  • You then type a number into that cell.

  • In the Format Cells dialog box, you then format the cell as a number.

The cell remains formatted as text.

Workaround

To convert cells that are formatted as text to numbers, follow these steps:

  1. Select the cell that is formatted as text that you want to convert to a number.

    Notice that the Error Checking Options button appears if you select the cell or rest the mouse pointer over the cell. The cell should contain an Error Indicator in the upper left corner of the cell.

    NOTE: If the Error Checking Options button does not appear or you do not see an Error Indicator, turn on background error checking.

    To do this in Microsoft Excel 2002 or in Microsoft Office Excel 2003, follow these steps:

    1. On the Tools menu, click Options.

    2. In the Options dialog box, click the Error Checking tab.

    3. In the Settings section, click to select the Enable background error checking check box.

    4. In the Rules section, make sure the Number stored as text rule is selected, and then click OK.

    To do this in Microsoft Office Excel 2007, follow these steps:

    1. Click the Microsoft Office Button, and then click Excel Options.

    2. On the Formulas tab, click to select the Enable background error checking check box in the Error Checking section.

    3. Under Error checking rules, make sure that the Numbers formatted as text or preceded by an apostrphe check box is selected, and then click OK.

  2. On the Error Checking Options button, click the down arrow.

    Notice that the Number Stored as Text menu appears.

  3. Click Convert to Number.

Notice that the cell is converted to the number format and the Error Indicator no longer appears in the cell.

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.

A comma-separated values (CSV) file is a delimited text file that uses a comma to separate values. Each line in a .csv file is a data record consisting of one or more fields, with each field separated by a comma. A .csv file can be imported to and exported from programs that store data in tables, such as Microsoft Office Excel, LibreOffice, or OpenOffice. When you open a .csv file in a spreadsheet, the spreadsheet uses the comma as the field separator (delimiter).

Here are the contents of a sample .csv file:

"name","roll number","dob","address"
"steve","011","10-Jan-2012","Jungle Road, Leominster MA 1453"
"jack","012","12-Mar-2012","Massachusetts Ave, Lunenburg MA 1462"
"rodriguez","013","11-May-2011","780 Lynnway, Lynn MA 1905"

When you open a .csv file in Microsoft Excel, it converts the text format to number or date format depending upon the data pattern in the .csv file. The automatic transformation of the data format may be undesirable in some cases. For instance, you may have a .csv file with the following contents:

In the above example, the roll number field has a leading zero, and the date of birth is specified in dd-mmm-yyyy format. But, when you open the .csv file in Excel, it truncates the leading zero(es) and formats the date fields into dd-mmm-yy format automatically. Here is an example:

With the automatic data type conversion, problems can happen when the .csv file contains the ZIP or postal codes, telephone numbers, or government-issued ID card numbers.

You may want to preserve the leading zero(es) and the original date format, and wondering how to prevent Excel from automatically transforming the data type.

Stop Excel from Converting Text to Number or Date format when Importing a CSV file

Option 1: Rename .csv to .txt and then open in Excel

To prevent Excel from automatically changing the data format to number/date format, you can rename the .csv file to .txt. Then open the .txt file from the File menu in Microsoft Excel.

Go through the following Text Import Wizard, select Text format for the required columns, and complete the process.

In Step 1, select Delimited (with is the default selection, anyway). And, choose the My data has headers options if your .csv file’s 1st line represents the caption or header text.

prevent excel convert data format import .csv file

In Step 2 of 3, Excel defaults to Tab as the delimiter, as we’re opening a file with extension .txt, not .csv.

Deselect Tab and select Comma, and click Next.

prevent excel convert data format import .csv file

Step 3 of 3 is an important step. You’ll see that General option is chosen as the default in the Column data format section. What the General option does is that it converts numeric values to numbers, date values to dates, and all remaining values to text. This is exactly what we do not want.

prevent excel convert data format import .csv file

Select the column — “roll number” — and select Text as the data format. Similarly, repeat the step for the Date column.

prevent excel convert data format import .csv file

Click Finish. Excel should now import the values exactly as in the .csv file, without truncating the leading zeroes or changing the date/time format.

prevent excel convert data format import .csv file

Don’t prefer renaming the .csv file to .txt every time? Then try Option 2.


Option 2: Import .csv file using the Import Data Sources feature

To preserve the original data (format) when opening a .csv in Excel, use the “Import data” option in Excel’s Data tab.

Select the Data tab in Excel, and click From Text/CSV

Browse to locate the .csv file from which you want to import the contents. You’ll see the preview window below where you can define the file origin, and change the delimiter if required. If the preview looks good, click on the Load button.

But, in this example, the leading zero in the roll number field is truncated — also, the date field in different data type than what’s in the original .csv file. So, we want to transform it back to the original format.

Click on the Transform Data button. This opens the Power Query Editor which shows exactly what you saw in the preview dialog above.

Important: If you are using Excel 2013 or earlier versions of Excel, you may need to enable Power Query in Excel. You can also download and install the most recent version of Power Query for Excel, which automatically enables it.

Select the columns which you want to transform (to Text format.)

From the Transform tab, click Data Type: and select Text (instead of General) from the drop-down box.

Click Replace current when you see the Change Column Type dialog.

Selecting the Text option makes Excel import the contents of the .csv file “as is,” without intelligently converting the fields to number or date format.

Verify the fields and if you’re satisfied with how Excel is displaying the contents, click on the Close & Load button in the Home tab. This closes the Power Query Editor and loads the data in your worksheet.

That’s it! You’ve now imported a .csv file into Excel without changing the data formats.


Option 3: Formatting the CSV file so that Excel doesn’t convert the data format

You can format the .csv file in such a way that opening it normally in Excel (not importing via the Data tab) doesn’t transform the data format from text to number or date. For example, prefix the date and roll number fields with "=" and suffix them with two double-quotes (""), like below:

"steve","=""011""","=""10-Jan-2012""","Jungle Road, Leominster MA 1453"

instead of:

"steve","011","10-Jan-2012","Jungle Road, Leominster MA 1453"

The “Equal To” symbol makes Excel import the field as a formula, and hence the field’s data format won’t be changed.

  • Note: If you’re using a program or script to output .csv files, you can export the file using the above format. However, note that the above workaround may not be helpful in all situations. For instance, it may not help if the field data also contains double-quotes or the “equal to” symbol.

Now, open the .csv file in Microsoft Excel by double-clicking on it.

prevent excel convert data format import .csv file

Excel should render the contents correctly (date & roll number fields) as in the .csv file.

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.

  1. 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.
  2. 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.

Convert Text to Numbers in Excel - Green Triangle

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.Convert Text to Numbers in Excel - Select Cells Green Triangle
  • 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.Convert Text to Numbers in Excel - text to column
  • 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?
  • If you would like to post, please check out the MrExcel Message Board FAQ and register here. If you forgot your password, you can reset your password.

  • Thread starter

    RHONDAK72

  • Start date

    Oct 15, 2009

  • #1

I have some cells that begin with «zz000123». I need to remove the «zz» but I also need for the «000» to stay in tact. The cells in the column are formatted as Text. But when I do the Edit-Replace function to replace «zz» with «», it takes off those 3 zeros as if it is converting it to a number format. I do not want that. What can I do to keep «000» in place?

:confused:

What does custom number format of ;;; mean?

Three semi-colons will hide the value in the cell. Although most people use white font instead.

  • #2

=RIGHT(A1,6) and copy down the column

  • #3

Hi RHONDAK72,

Assuming your data is always uniform in length , you could
insert a column next to your data & use the formula beow:

=RIGHT(A1,7)

This is assuming 9 characters , it will remove the zz prefix
where neccessary , but if you have no zz prefix it will still
report the 7 digits , alpha & numeric.

Example1 : ZZOOO1234 = OOO1234
Example2 : OOO1234 = OOO1234

HTH

Russ

  • #4

Try to edit replace «zz» with «‘» (single hyphen)

  • #5

Unfortunately, the length varies. Some cells are 9 digits and some are longer.

  • #6

Edit-Replace zz with ‘ (single hyphen) works. I tried.

RoyalRife

RoyalRife

Threads
1,192,536
Messages
5,993,052
Members
440,469
Latest member
Quaichlek

Save 5 minutes a day by using ASAP Utilities to quickly fix the numbers that Excel may not recognize.

«Easily make Excel recognize the numbers in your selection»

Sometimes Excel fails to recognize numbers properly, which causes unexpected results when you sort, filter, or use formulas.

For example, when you import a file that was created in another program, such as an accounting package, downloaded from a mainframe or copied from a website, then Excel may fail to recognize the numbers.

Some Excel values may then look like numbers, but Excel thinks they are text. These numbers are then usually left-aligned (by default, text is left-aligned and numbers are right-aligned in Excel).

You sometimes may experience that:

  • A formula isn’t calculating your numbers properly, such as the SUM of cells, because the ‘text’-number are ignored.
  • Excel does not allow you to change the number format of selected cells.
  • The sort order is confusing and incorrect.
  • You have fractions in your cells that Excel doesn’t recognize and can’t calculate, such as 1/4.
  • Excel’s built in error checking option and correction isn’t available or does not fix the numbers.

But this is easy to fix. Just select the cells and use:
ASAP Utilities » Numbers & Dates » Convert unrecognized numbers (text?) to numbers

ASAP Utilities » Numbers & Dates » Convert unrecognized numbers (text?) to numbers

Quickly fix all numbers that Excel does not recognize at once

This «Convert unrecognized numbers (text?) to numbers» tool quickly fixes the numbers in your selection.
It will:

  • Remove leading and trailing spaces around cells with numbers.
  • Remove apostrophes in front of numbers.
  • If the number format in the cells with numbers is «Text» then it will be changed to «General» in these cells.
  • Handle non breaking spaces (this so called character, char 160, is commonly used in web pages as the HTML entity,  ).
  • Remove leading zeros.
  • Recognize and fix text-numbers that are displayed as fractions (such as 1/4, 1/2, etc.)
  • Preserve long numbers such as credit cards. Unlike Excel, it will not change the last digit to a zero such as from credit card numbers, which is what Excel’s built-in «Convert Text to Number» does.
  • Empty cells that only contain one or more spaces.
  • Turn all empty cells into truly empty/blank cells that Excel recognizes as being empty.
  • Skip cells with formulas or text.

Tip: If your formulas don’t give the correct result or don’t calculate, then in addition to fixing the numbers, you may also want to verify that the calculation of your workbook is set to Automatic (or press F9 to calculate when calculation is set to Manual):

Calculation options Excel set to automatic

ASAP Utilities compared to Excel’s built in «Convert to number»

Excel Error Checking - Convert to NumberExcel (2002+) has built in «Error Checking Options», which can help to detect numbers stored as text and help sometimes to fix them. Numbers that are formatted as text are left-aligned instead of right-aligned in the cell, and are often marked with an error indicator.

If the cells in which numbers are displayed as text contain an error indicator in the upper-left corner (a small green triangle), you can select that cell and then click the error button next to the cell. Then you can choose «Convert to Number» on the pop-up menu.

While this is a handy tool, it doesn’t always detect all numbers that are stored as text properly and you cannot choose your own range to run Microsoft Excel’s built-in «Convert to Number» tool on.

When compared to Excel’s built-in solution, these are the benefits of ASAP Utilities:

  1. You decide which cells to convert and when. It even works in multiple non-adjacent selected ranges.
  2. You can assign your own shortcut to this tool for quick use.
  3. It fixes numbers that Excel can’t.

Do you recognize any of these situations?

  • I copied some numbers on a web page and pasted them onto an excel spreadsheet. When I use the sum formula, or average formula, excel is not recognizing the numbers in the cell, and won’t add up my rows. I’ve tried reformatting the field as a number, but it’s not working. If I re-type the numbers in the field, then Excel recognizes them. This is frustrating!
  • I am trying to find the average for a list of numbers. These numbers were pulled from a database, run through a mail-merge program and then given back to me. They look like normal numbers, and don’t seem to have any odd formatting, but the AVERAGE function does not seem to see them, and returns a #DIV/0! error. When I click on the cells as if I am going to change the data, the numbers are suddenly recognized by the formula as if they have changed format somehow. Is there some way I can change the format of these numbers, I don’t want to have to double click on thousands of cells to miraculously change them to be recognized….
  • I have a user with a query from an SQL Database that returns a series of strings that are actually numbers, but Excel treats them as text-strings.
  • I’ve copied a column of data (numbers) from a website and pasted it in Excel. However, the numbers are not recognized as numeric values (we can’t sum them, etc.). We have tried all of the «easy» solutions such as changing their format to general or number, copying a 1 from another cell in a clean workbook and using the paste special/multiply function… We’ve tried the text to columns thing, basically have tried everything in the MS KB, but nothing works except for retyping the value in each cell, which is a bummer since we’ve got about 2000 cells. Any solutions?
  • Excel will not change the format of my cells. I have copied a table that I found online. The problem after the import is that Excel will not change the format of selected cells. I am trying to change some cells to a number format. The only way it will accept the change is to clear the cell and retype it. There are too many numbers to make that fix acceptable.
  • I have a bunch of numbers that are preceded with an apostrophe. If I use Excel’s Find/Replace and try to replace the apostrophe with nothing, Excel will not recognize it, and nothing will happen. How can we fix this quickly without having to re-enter the numbers?
  • Among my data I had creditcard numbers and Excel’s Error Checking stripped the last numbers from it.
  • My =VLOOKUP() formulas can’t find any matching numbers because of unwanted spaces.
  • Cells that appear empty aren’t because they contain a space.
  • Excel doesn’t recognize some cells as being empty. That happens often with imported data.
  • I tried to remove the spaces by using Excel’s =TRIM() function but it didn’t remove the spaces in my case. I found that this can happen with so called «non-breaking» spaces. See also this article from Microsoft that describes how to remove these unwanted spaces.

Just select the cells and then choose the following tool in the Excel menu:
ASAP Utilities » Numbers & Dates » Convert unrecognized numbers (text?) to numbers

We find that this tool is often easier, quicker and also more reliable than Microsoft’s advised and built-in methods (text to number/paste special workaround, or the text to columns workaround).
And to increase your productivity you can assign your own shortcut to this tool.

Bonus tips, also interesting

  • ASAP Utilities » Format » Clean data and formatting…
  • ASAP Utilities » Numbers & Dates » Convert/recognize dates…
  • ASAP Utilities » Numbers & Dates » Change values to text values (adding ‘ in front)
  • ASAP Utilities Tip: Easily remove certain or several characters at once
  • ASAP Utilities Tip: Easily remove leading characters
  • ASAP Utilities Tip: Quickly remove the leading zeros from numbers
  • ASAP Utilities Tip: Get rid of unwanted spaces in your data
  • ASAP Utilities Tip: Quickly (un)protect all sheets at once

How much time will it save?

It’s guaranteed that you’ll save yourself time and effort by using this tool. However, the actual time saved depends on how much you use Excel, the amount of data you are working with and how often you use this particular tool.
You can easily see how much time ASAP Utilities has saved you so far.

Download

In case you don’t have ASAP Utilities yet, you can download the free Home&Student edition (for home projects, schoolwork and use by charitable organizations) or the fully functional 90-day Business trial.
Download page

This post is going to show you all the ways you can convert text to numbers in Microsoft Excel.

An issue that comes up quite often in Excel is numbers that have been entered or formatted as text values.

This can cause many headaches when trying to troubleshoot why a formula like a SUM is not giving the correct answer.

Even though the data looks like a number, it can actually be a text value and will be ignored from any numerical calculations like a sum.

In this post, I will show you how you can identify such numbers which are stored as text values, and 7 ways you can use to convert the text into a proper number value.

How to Indentify Numbers Entered as Text

How can you tell if your number data has been entered as text?

There are quite a few easy ways to tell!

Left Aligned

The first way you might be able to tell if you have text values instead of numerical values is the way the data is aligned in the cell.

By default text is left aligned and numbers are right aligned.

Unless the alignment formatting has been changed from the default, this will be an easy way to spot numbers that have been formatted as text.

Green Triangle Error Checking

If you don’t realize you have numbers entered as text values, it can potentially cause some serious errors. This is why it’s flagged by Excel’s built-in error checker.

Any cells that are flagged with an error will show a small green triangle in the left of the cell to visually indicate an error.

When you select such a cell a small warning icon will appear.

When you click on this, it will show you what the error is. In this case, you can see the error is Number Stored as Text.

You can turn off this error checking entirely, or customize which errors are flagged.

Go to the File tab and then select Options at the bottom. This will open up the Excel Options menu.

In the Formula section of the Excel Options menu ➜ Error Checking.

Uncheck the Enable background error checking option to disable this feature. You can also customize the color used to indicate errors here.

Text Format Applied

One way that numbers get entered as text is when the cell has been formatted as text. This causes values to be entered as text values regardless of whether they are numerical.

There is a quick way to determine whether or not a cell has had text formatting applied.

Select the cell and go to the Home tab. You will be able to see if Text is the selected formatting in the dropdown menu found in the Number section of the ribbon.

Preceding Apostrophe

Another way that numbers can be entered as text is by using a preceding apostrophe.

When you enter an apostrophe ' as the first character in a cell, anything after will be regarded as a text value by Excel.

This means if you see a leading apostrophe in the formula bar, you know the data is a text value.

Use the ISTEXT Function

Excel has a function you can use to test if a value is a text value or not.

ISTEXT ( input )
  • input is the value, cell or range which you want to test if it is text.

The ISTEXT function will return TRUE if the value is text and FALSE otherwise.

= ISTEXT ( B3 )

Here you can see the ISTEXT function being used to determine if the cells contain text. The function returns TRUE when it finds a text value.

ISNUMBER ( input )
  • input is the value, cell or range which you want to test if it is a number.

Similarly, you can test if a value is a number using the ISNUMBER function. It takes a single input and returns TRUE when the value is a number and FALSE otherwise.

Here the same data is tested using the ISNUMBER function. The function returns FALSE when it does not find a number.

Status Bar Only Shows a Count

Another way to quickly test a range of cells to see if they are all text is by using the status bar.

When you select a range of numerical values, Excel will show you some basic statistics like the sum, min, max, and average in the status bar.

If they are all numbers entered as text values, then these basic statistics won’t be calculated. Instead, you will only see the count of the cells in the status bar.

Note: If just one of the cells is a numerical value, you will see the full set of statistics in the status bar.

Convert Text to Number with Error Checking

You have already seen that you can use error checking to spot numbers entered as text.

The error checking will also allow you to convert these text values into proper numbers.

Click on the Error icon and choose Convert to Number from the options. Excel will then convert each cell in the selected range into a number.

Note: This option can be very slow when you have a large number of cells to convert.

Convert Text to Number with Text to Column

Usually, Text to Columns is for splitting data into multiple columns. But with this trick, you can use it to convert text format into the general format.

Text to Column will let you choose a delimiter character to split your data based on. If you deselect this option and don’t pick any delimiter then it won’t split your data.

You are then able to choose how to format the results, and this is where you can choose a general format for the output.

Follow these steps to use the text to column feature to convert text to numbers.

  1. Select the cells that contain the text which you want to convert into number.
  2. Go to the Data tab.
  3. Click on the Text to Column command found in the Data Tools tab.

  1. Select Delimited in the Original data type options.
  2. Press the Next button.

  1. Press the Next button again in step 2 of the Convert Text to Columns wizard. You can keep the default options.

  1. Select General from the Column data format option.
  2. Select a Destination if you want to place the converted values in a new location. Otherwise you can keep the default value which should be the active cell, this will replace the text with numeric values.
  3. Press the Finish button.

This will convert your text values into numerical values.

The Text to Column command is usually used to split comma-separated or other delimiter separated data into multiple columns.

Any delimited data will be text data, so when Excel splits the data into multiple columns it also converts numerical data into numbers for added convenience.

This is also true even if there is nothing to split!

So the Text to Column wizard can be used to converts numerical text values to numbers.

Convert Text to Number with Multiply by 1

Even when values are stored as text you can still perform certain numerical calculations with them and the results of these calculations will also be numerical values.

You can use this to convert the text into numbers by multiplying them by 1. Since you are multiplying by 1, it won’t change the numbers but it will convert them.

= B3 * 1

You can use the above formula in an adjacent cell and copy and paste it down to convert an entire column.

If you want to remove the formula after, you can copy and paste them as values.

Convert Text to Number with Paste Special Multiply

Multiplying by 1 is a great trick for converting text to values, but you might not want to use a formula for this.

The great news is there is an easy way to multiply your text by 1 without using a formula.

This means you can convert your text in place and you don’t need to copy and paste formulas as values in an additional step.

You can use Paste Special Multiply to convert your text values. Follow these steps to multiply by 1 using Paste Special.

  1. Enter 1 into a cell elsewhere in the sheet. The 1 doesn’t even need to be a number value and can be a text value.
  2. Copy the cell which contains 1 using Ctrl + C on your keyboard or right click and choose Copy.
  3. Select the cells with the text values to convert.

  1. Press Ctrl + Alt + V on your keyboard or right click and choose Paste Special. This will open up the Paste Special menu.
  2. Select Values under the Paste options and select Multiply under the Operation options.
  3. Press the OK button.

This will multiply all the values by 1 which was the value in the copied cell. As a result, the text is converted into values, but since you are multiplying by 1 the numbers won’t change.

Convert Text to Number with VALUE Function

There is actually a dedicated function you can use for converting text to numerical values.

The VALUE function takes a text value and returns the text value as a number.

= VALUE ( text )
  • text is the text value you want to convert into a numerical value.

If the text contains any non-numerical characters, then the VALUE function will return a #VALUE! error. It doesn’t extract numbers from text, it can only convert numbers entered as text into numbers.

= VALUE ( B3 )

You can use the above formula to convert the text in cell B3 into a number and then copy and paste the formula to convert the entire column.

Convert Text to Number with Power Query

Power Query is an amazing tool for any type of data transformation required. It can certainly be used to convert text into numbers as well.

Power Query is strongly typed. This means calculations with incompatible data types will result in an error. So you won’t be able to multiply text values by 1 to convert them into numbers.

But Power Query does come with an easy way to convert data types, including text to numbers.

Follow these steps once your data has been imported into Power Query.

Click on the data type icon to the left side of the column heading for the values you want to convert.

Each column in the Power Query editor has a data type icon that displays the current data type of the column. If the column has not been assigned a data type, then the icon shown will be ABC123.

There are several numeric data types available in Power Query and which one you choose will depend on the level of decimal precision you need.

In this case, you can select the Whole Number option from the menu.

Notice the values in the column are now right-aligned and the data type icon has changed? These are visual indicators that the data type is now whole numbers instead of text.

= Table.TransformColumnTypes(Source,{{"Text", Int64.Type}})

You will see a new Changed Type step has been applied to the query and it will use the above M code formula.

You can then press the Close & Load button in the Home tab to save the results and load the data into Excel.

You might not even need to apply this data type conversion step to your query. When you first import data into Power Query, it will usually guess the data type and apply the conversion for you!

Convert Text to Number with Power Pivot

If you want to analyze or summarize your data after you convert it from text to numbers, then you might want to do the conversion in Power Pivot.

Power Pivot is an add-in that allows you to efficiently analyze millions of rows in the data model with Pivot Tables.

With Power Pivot, you can build row-level calculations using the DAX formula language to create new columns in your datasets. You can then access these new columns in your pivot tables connected to the data model.

In this case, the DAX formula you can use to convert text to numbers is the exact same as the formula in the grid.

Follow these steps inside the Power Pivot add-in to create a new calculated column that converts the text to numbers.

Select any cell under the Add Column heading.

=VALUE(TextNumbers[Text])

Insert the above formula. TextNumbers is the name of the table of data in Power Pivot and Text is the name of the column you want to convert.

Double click on the column heading to change the name.

Press the Save icon and close the Power Pivot add-in.

Now you can create a pivot table from the data model and this new column will be available for use inside the pivot table just like any other field.

  1. Go to the Insert tab.
  2. Click on the PivotTable button.
  3. Choose From Data Model in the available options.

The calculated column will be available in your pivot table fields list and you will be able to use it like any other number field.

Conclusions

There are many reasons why you might have data that contains numbers formatted as text.

If you want to freely use these values in your calculations, you will need to convert them into numbers.

Thankfully, there are many easy options to convert text to numbers such as error checking, paste special, basic multiplication, and the VALUE function. These are all easy ways to convert text inside the grid.

If you’re importing your data using Power Query or Power Pivot, you can perform the conversion inside each of these tools. Both have methods available to convert text to numbers.

Do you use any of these methods to change your text values to numbers? Do you know any other interesting ways to perform this action? Let me know in the comments below!

About the Author

John MacDougall

John is a Microsoft MVP and qualified actuary with over 15 years of experience. He has worked in a variety of industries, including insurance, ad tech, and most recently Power Platform consulting. He is a keen problem solver and has a passion for using technology to make businesses more efficient.

Option 1: Change the column formatting from Text to General by multiplying the numbers by 1:

1. Enter the number 1 into a cell and copy it.
2. Select the column formatted as text, press Shift+F10 or right-click, and then select Paste Special from the shortcut menu.
3. Select the Multiply option button in the Paste Special dialog box, and then click OK.

Option 2: Change the column formatting from Text to General using the Text to Columns technique:

1. Select the column formatted as text.
2. From the Data menu, select Text to Columns.
3. In Step 1 of 3, select the Fixed width option button.
4. Skip Step 2 of 3.
5. In Step 3 of 3, select the General option button in the Column data format section, and then click Finish.

Screenshot // Problem: Values Not Formatting as Numbers
Problem: Values Not Formatting as Numbers Problem: Values Not Formatting as Numbers Problem: Values Not Formatting as Numbers

Понравилась статья? Поделить с друзьями:
  • Excel english version download
  • Excel do not calculate on save
  • Excel do not calculate on open
  • Excel do loop exit
  • Excel do loop continue