Format cell to number in excel

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?

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?

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.

To change the cell format from date to number we convert the formatting into General Format in Microsoft Excel.

There are three different ways to change the formatting from date to number.

1st Shortcut Key

2nd Format Cells

3rd Command Button

Let’s take an example and understand how we can convert cell formatting from date to number or general formatting.

We have date in column D. In column E we will learn to convert the cell format from date to number through shortcut key, in column F through Format Cells and in Column G through Command button.

img1

 
To change the cell formatting by using the Shortcut Key

Follow below given steps:-

  • Select the range E3:E11.
  • Press the key Ctrl+Shift+~ on your keyboard.
  • Cells formatting will get convert into numbers.

img2

 
To change the cell formatting by using Format Cells

Follow below given steps:-

  • Select the range F3:F11 and press the key Ctrl+1 on your keyboard.
  • A format Cells dialog box will appear.

img3
 

  • In the Number Tab, Click on General.
  • We can see the formatting in sample preview.
  • The function will convert the formatting into general formatting.

img4

 
img5

 
To change the cell formatting by using Command Button

Follow below given steps:-

  • Select the range G3:G11.
  • Go to Home Tab click on General in the Number group.

img6
 

  • Date format will get convert in General format.

img7
 

These are the ways in which we can convert the cell formatting from date to number in Microsoft Excel.

image 48

If you liked our blogs, share it with your friends on Facebook. And also you can follow us on Twitter and Facebook.
We would love to hear from you, do let us know how we can improve, complement or innovate our work and make it better for you. Write us at info@exceltip.com

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

force, number, excel, manually, enter, cell
First try: Go into cell and press enter.

In many cases it’s enough if you enter the cell for editing it and confirm by pressing enter on the keyboard.

  1. First: Make sure that the cell is formatted as number. Therefore press Ctrl computer_key_Ctrl+ 1 computer_key_num_row_1on the keyboard and set the “Category” on the “Number” tab to “Number.
  2. Now enter the cell by pressing F2 computer_key_F2on the keyboard.
  3. Then press enter computer_key_Enter.

Is the cell a number cell now?

Method 2: Force to number by multiplying with 1

multiply, 1, one, cell, force, number, excel
Force Excel to change the format from Text to Number by multiplying all cells with “1”.

Luckily, if you are converting a text format to a number format, there is an easy workaround:

  1. Change the format of the cell to “Number” by pressing Ctrl computer_key_Ctrl+1 computer_key_num_row_1(Mac: Cmd + 1) and select number in the “Number”-tab. Confirm by pressing Enter on the keyboard computer_key_Enteror clicking OK.
  2. Write “1” into an empty cell.
  3. Copy this cell.
  4. Select the cells you want to force to the number format.
  5. “Paste Special” by press Ctrl computer_key_Ctrl+ Alt computer_key_Alt+ v computer_key_V(Mac: Ctrl + Cmd + v).
  6. 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.
  7. 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’

force, convert, number, excel
Comfortably convert text cell 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.


Professor Excel Tools Box

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, text, cell
Format cell as text as the first step.

Format the cell to text by pressing Ctrl computer_key_Ctrl+ 1 computer_key_num_row_1. Please note that sometimes Excel automatically switches back to number.

Method 2: Add an ‘ (apostrophe)

format, cell, text, apostrophe, '
Insert an ‘ for forcing a cell to the text format.

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”.

Bulk force to text with Professor Excel Tools.

Bulk force to text with Professor Excel Tools.

Professor Excel Tools Box

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

force, format, vba, refresh, macro
Force any format to an Excel cell by using a short VBA code.

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:

  1. Select all the cells you want to change the format.
  2. Change the format the cell to “Number” by pressing Ctrl computer_key_Ctrl+1 computer_key_num_row_1 at the same time and select your desired cell format under the “Number”-tab.
  3. Make sure, that your cells are still selected.
  4. Press Alt computer_key_Alt+ F11 computer_key_F11for opening the VBA editor.
  5. Press Ctrl computer_key_Ctrl+ G computer_key_Gfor opening the “Immediate”-Window.
  6. Paste the following code and press enter computer_key_Enter.
For Each cl In Selection:cl.Formula=cl.Formula:Next cl

Note: This way works also for converting a text cell to number.

Понравилась статья? Поделить с друзьями:
  • Format cell in excel custom
  • Format cell for excel
  • Format cell by formula excel
  • Format button on word
  • Format boxes in word