InterServer Web Hosting and VPS

How to Convert Text to Number in Excel

How to convert text to number in Excel? The other way is very simple. If you want that a column or a row contains numbers, you can use an excel conversion formula that will convert the text into a number. We all know that text and numbers are treated differently in Excel. The best example is when you want to use them in a formulas. Formulas don’t recognize text, but they recognize numbers.

In this review we shall be looking at converting text to numbers and numbers to words .

Convert numbers into words

Excel for Microsoft 365 Excel 2021 Excel 2019 Excel 2016 Excel 2013 Excel 2010

Excel doesn’t have a default function that displays numbers as English words in a worksheet, but you can add this capability by pasting the following SpellNumber function code into a VBA (Visual Basic for Applications) module. This function lets you convert dollar and cent amounts to words with a formula, so 22.50 would read as Twenty-Two Dollars and Fifty Cents. This can be very useful if you’re using Excel as a template to print checks.

If you want to convert numeric values to text format without displaying them as words, use the TEXT function instead.

Note: Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the VBA programming language, and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality, or construct procedures to meet your specific requirements.

Create the SpellNumber function to convert numbers to words

  1. Use the keyboard shortcut, Alt + F11 to open the Visual Basic Editor (VBE).Note: You can also access the Visual Basic Editor by showing the Developer tab in your ribbon.
  2. Click the Insert tab, and click Module.On the Insert menu, click Module.
  3. Copy the following lines of code.Note: Known as a User Defined Function (UDF), this code automates the task of converting numbers to text throughout your worksheet.Option Explicit 'Main Function Function SpellNumber(ByVal MyNumber) Dim Dollars, Cents, Temp Dim DecimalPlace, Count ReDim Place(9) As String Place(2) = " Thousand " Place(3) = " Million " Place(4) = " Billion " Place(5) = " Trillion " ' String representation of amount. MyNumber = Trim(Str(MyNumber)) ' Position of decimal place 0 if none. DecimalPlace = InStr(MyNumber, ".") ' Convert cents and set MyNumber to dollar amount. If DecimalPlace > 0 Then Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _ "00", 2)) MyNumber = Trim(Left(MyNumber, DecimalPlace - 1)) End If Count = 1 Do While MyNumber <> "" Temp = GetHundreds(Right(MyNumber, 3)) If Temp <> "" Then Dollars = Temp & Place(Count) & Dollars If Len(MyNumber) > 3 Then MyNumber = Left(MyNumber, Len(MyNumber) - 3) Else MyNumber = "" End If Count = Count + 1 Loop Select Case Dollars Case "" Dollars = "No Dollars" Case "One" Dollars = "One Dollar" Case Else Dollars = Dollars & " Dollars" End Select Select Case Cents Case "" Cents = " and No Cents" Case "One" Cents = " and One Cent" Case Else Cents = " and " & Cents & " Cents" End Select SpellNumber = Dollars & Cents End Function ' Converts a number from 100-999 into text Function GetHundreds(ByVal MyNumber) Dim Result As String If Val(MyNumber) = 0 Then Exit Function MyNumber = Right("000" & MyNumber, 3) ' Convert the hundreds place. If Mid(MyNumber, 1, 1) <> "0" Then Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred " End If ' Convert the tens and ones place. If Mid(MyNumber, 2, 1) <> "0" Then Result = Result & GetTens(Mid(MyNumber, 2)) Else Result = Result & GetDigit(Mid(MyNumber, 3)) End If GetHundreds = Result End Function ' Converts a number from 10 to 99 into text. Function GetTens(TensText) Dim Result As String Result = "" ' Null out the temporary function value. If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19... Select Case Val(TensText) Case 10: Result = "Ten" Case 11: Result = "Eleven" Case 12: Result = "Twelve" Case 13: Result = "Thirteen" Case 14: Result = "Fourteen" Case 15: Result = "Fifteen" Case 16: Result = "Sixteen" Case 17: Result = "Seventeen" Case 18: Result = "Eighteen" Case 19: Result = "Nineteen" Case Else End Select Else ' If value between 20-99... Select Case Val(Left(TensText, 1)) Case 2: Result = "Twenty " Case 3: Result = "Thirty " Case 4: Result = "Forty " Case 5: Result = "Fifty " Case 6: Result = "Sixty " Case 7: Result = "Seventy " Case 8: Result = "Eighty " Case 9: Result = "Ninety " Case Else End Select Result = Result & GetDigit _ (Right(TensText, 1)) ' Retrieve ones place. End If GetTens = Result End Function ' Converts a number from 1 to 9 into text. Function GetDigit(Digit) Select Case Val(Digit) Case 1: GetDigit = "One" Case 2: GetDigit = "Two" Case 3: GetDigit = "Three" Case 4: GetDigit = "Four" Case 5: GetDigit = "Five" Case 6: GetDigit = "Six" Case 7: GetDigit = "Seven" Case 8: GetDigit = "Eight" Case 9: GetDigit = "Nine" Case Else: GetDigit = "" End Select End Function
  4. Paste the lines of code into the Module1 (Code) box.Code pasted in the Module1 (Code) box.
  5. Press Alt + Q to return to Excel. The SpellNumber function is now ready to use.Note: This function works only for the current workbook. To use this function in another workbook, you must repeat the steps to copy and paste the code in that workbook.

Top of Page

Use the SpellNumber function in individual cells

  1. Type the formula =SpellNumber(A1) into the cell where you want to display a written number, where A1 is the cell containing the number you want to convert. You can also manually type the value like =SpellNumber(22.50).
  2. Press Enter to confirm the formula.

Top of Page

Save your SpellNumber function workbook

Excel cannot save a workbook with macro functions in the standard macro-free workbook format (.xlsx). If you click File > Save. A VB project dialog box opens. Click No.In the VB project dialog box, click No.

You can save your file as an Excel Macro-Enabled Workbook (.xlsm) to keep your file in its current format.

  1. Click File > Save As.
  2. Click the Save as type drop-down menu, and select Excel Macro-Enabled Workbook.
  3. Click Save.

Method 2

Is Cell Data Text Or Numbers?

There are several ways you can see if a number or set of numbers in a column or row is formatted as text in Excel.

The easiest way is to select the cell, select the Home menu, and under the Number group in the ribbon, note the number format displayed in the dropdown box.

If the dropdown box displays “text”, you know the cell is formatted as text format. If you want to perform numerical calculations on the cell using Excel formulas, you’ll need to convert it first.

In the case where someone has entered numbers in text format using the apostrophe in the cell, you’ll see a small green triangle indicating the value has been entered as text.

Note: Preceding a cell entry with an apostrophe forces the cell formatting to text-based.

If you’ve discovered, using either of the approaches above, that the numerical data is entered into the Excel sheet in text format, you can use any of the methods below to convert that text to numbers.

1. Convert To Number

If you need to convert data that’s been entered into Excel with an apostrophe, you can easily convert it back to number format using the Convert to Number option.

1. First, select the cells you want to convert back to number format. You will see a yellow diamond appear near the selection with an exclamation symbol in the middle.

2. Select this symbol. From the dropdown, choose Convert to Number

This will update all of the text based numbers you’ve selected to the General numeric data format. 

You’ll know it worked when all the numbers in your selection switched from being left aligned to right aligned in the cells.

2. Using Text to Column

Another easy way to convert text to numbers in Excel is by converting over an entire column of values at once. You can do this using the Text to Column feature.

1. Select the entire column of data that you want to convert from text to numbers.

2. Select Data from the menu, and then select Text to Columns in the Data Tools section of the ribbon.

3. In the Wizard window, keep the default Delimited selected and select Next

4. On the next Wizard page, keep the default Tab selected, and select Next again.

5. Finally, on the last page of the Wizard, make sure General is selected under Column data format. For the Destination field, you can either select a new column where you want the number data to go, or just keep the current selected column as is. Select Finish.

Now your data will all be converted to numeric values, which you can use in Excel formulas and calculations.

Note: You’ll notice that the actual cell formatting doesn’t change from Text to General even though the values themselves can now be used as numbers. However, if you set your output column to a new column, you will notice that the formatting of the new column is set to General. This is only a cosmetic issue and doesn’t affect how the numbers in the “Text” formatted column behave.

3. Changing Cell Format

The easiest and fastest way to convert text to numbers in Excel is simply changing the cell formatting from the Home menu.

To do this:

1. Select all of the cells you want to convert. You can select an entire column (don’t include the header) if you want to convert all of the cells in a column.

2. Select the Home menu, and in the Number group on the ribbon, select the dropdown box with Text in it. 

3. You’ll see a list of formats to choose from. Select General to convert to number format. Or you can select Number, Currency, Accounting, or Percentage if you want those specific number formats applied to your numerical data.

4. Using Paste Values

If you need to move text cells that contain numbers into a new cell or column, you can use the Paste Special feature.

1. Select the group of empty cells where you want to place your output of numeric data. Select Format Cells from the pop-up menu.

2. In the window that opens, make sure General is selected as the number format and select OK.

3. Select the entire column of cells you want to convert from text to numbers, right-click, and select Copy.

4. Select the first cell in the empty column you formatted, right-click the cell and select Paste Values. You’ll see all of the text formatted numbers pasted in the General number format.

This works because when you select Paste Values, it pastes only the values from the source cell and not the original cell formatting. Instead, it uses the destination cell formatting, which you configured in the first part of this process.

5. Using The VALUE Function

There is a special function in Excel that’ll convert a number formatted as text into a numeric value. This is the VALUE function.

To use this function, select the cell where you want the converted number to go and type:


Replace “G2” above with the cell that has the number you want to convert. If you’re converting an entire column of numbers, start with the first cell only.

Press Enter and you’ll see that the text-formatted number has been converted to a General-format number. 

You can then fill the rest of the empty column to the bottom of that column and the VALUE formula will convert the rest of the cells in the original column as well.

After using any of these options for reformatting your numbers, you may need to refresh cell data after applying the new formatting. 

As you can see, there are a number of ways to convert text to numbers in Excel. The option you choose just depends on where you’re trying to place the output. It also depends whether you prefer using copy and paste, Excel formulas, or menu options.

Ultimately, each of these choices provides you with the same end result.


Text to Number conversion in Excel is one of the most frequently used functions. It is necessary for converting text based values to numeric values within the defined bounds. It is useful for converting defined words or dates or any other text based information to numbers so that they can be used in different formulas.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *