Value in words in excel

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

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

  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.

Top of Page

See Also

TEXT function

Need more help?

totn Excel Functions


This Excel tutorial explains how to convert number into words (with screenshots and step-by-step instructions).

Question: In Microsoft Excel, how can I convert a numeric value to words? For example, for a value of 1, could the cell show the word «one» instead?

Microsoft Excel

Answer: There is no-built in Excel function that will convert a number into words. Instead, you need to create a custom function to convert the number into words yourself. Let’s explore how.

To see the completed function and how it is used in the example below, download the example spreadsheet.

Download Example

TIP: When you create a custom function in Excel, it will create macro code. When you open your file after creating the custom function, it will warn that there are macros in the spreadsheet. You will need to enable the macros for the function to work properly.

Let’s get started. First, you’ll need to open your Excel spreadsheet and press Alt+F11 to open the Microsoft Visual Basic for Applications window. Under the Insert menu, select Module.

Microsoft Excel

This will insert a new module in your spreadsheet called Module1. Paste the following two functions into the new module.

' Example created by techonthenet.com
Function EnglishNumber(ByVal N As Currency) As String

   Const Thousand = 1000@
   Const Million = Thousand * Thousand
   Const Billion = Thousand * Million
   Const Trillion = Thousand * Billion

   If (N = 0@) Then EnglishNumber = "zero": Exit Function

   Dim Buf As String: If (N < 0@) Then Buf = "negative " Else Buf = ""
   Dim Frac As Currency: Frac = Abs(N - Fix(N))
   If (N < 0@ Or Frac <> 0@) Then N = Abs(Fix(N))
   Dim AtLeastOne As Integer: AtLeastOne = N >= 1

   If (N >= Trillion) Then
      Buf = Buf & EnglishNumberDigitGroup(Int(N / Trillion)) & " trillion"
      N = N - Int(N / Trillion) * Trillion
      If (N >= 1@) Then Buf = Buf & " "
   End If

   If (N >= Billion) Then
      Buf = Buf & EnglishNumberDigitGroup(Int(N / Billion)) & " billion"
      N = N - Int(N / Billion) * Billion
      If (N >= 1@) Then Buf = Buf & " "
   End If

   If (N >= Million) Then
      Buf = Buf & EnglishNumberDigitGroup(N  Million) & " million"
      N = N Mod Million
      If (N >= 1@) Then Buf = Buf & " "
   End If

   If (N >= Thousand) Then
      Buf = Buf & EnglishNumberDigitGroup(N  Thousand) & " thousand"
      N = N Mod Thousand
      If (N >= 1@) Then Buf = Buf & " "
   End If

   If (N >= 1@) Then
      Buf = Buf & EnglishNumberDigitGroup(N)
   End If

   EnglishNumber = Buf
End Function

Private Function EnglishNumberDigitGroup(ByVal N As Integer) As String

   Const Hundred = " hundred"
   Const One = "one"
   Const Two = "two"
   Const Three = "three"
   Const Four = "four"
   Const Five = "five"
   Const Six = "six"
   Const Seven = "seven"
   Const Eight = "eight"
   Const Nine = "nine"
   Dim Buf As String: Buf = ""
   Dim Flag As Integer: Flag = False

   Select Case (N  100)
      Case 0: Buf = "": Flag = False
      Case 1: Buf = One & Hundred: Flag = True
      Case 2: Buf = Two & Hundred: Flag = True
      Case 3: Buf = Three & Hundred: Flag = True
      Case 4: Buf = Four & Hundred: Flag = True
      Case 5: Buf = Five & Hundred: Flag = True
      Case 6: Buf = Six & Hundred: Flag = True
      Case 7: Buf = Seven & Hundred: Flag = True
      Case 8: Buf = Eight & Hundred: Flag = True
      Case 9: Buf = Nine & Hundred: Flag = True
   End Select

   If (Flag <> False) Then N = N Mod 100
   If (N > 0) Then
      If (Flag <> False) Then Buf = Buf & " "
   Else
      EnglishNumberDigitGroup = Buf
      Exit Function
   End If

   Select Case (N  10)
      Case 0, 1: Flag = False
      Case 2: Buf = Buf & "twenty": Flag = True
      Case 3: Buf = Buf & "thirty": Flag = True
      Case 4: Buf = Buf & "forty": Flag = True
      Case 5: Buf = Buf & "fifty": Flag = True
      Case 6: Buf = Buf & "sixty": Flag = True
      Case 7: Buf = Buf & "seventy": Flag = True
      Case 8: Buf = Buf & "eighty": Flag = True
      Case 9: Buf = Buf & "ninety": Flag = True
   End Select

   If (Flag <> False) Then N = N Mod 10
   If (N > 0) Then
      If (Flag <> False) Then Buf = Buf & "-"
   Else
      EnglishNumberDigitGroup = Buf
      Exit Function
   End If

   Select Case (N)
      Case 0:
      Case 1: Buf = Buf & One
      Case 2: Buf = Buf & Two
      Case 3: Buf = Buf & Three
      Case 4: Buf = Buf & Four
      Case 5: Buf = Buf & Five
      Case 6: Buf = Buf & Six
      Case 7: Buf = Buf & Seven
      Case 8: Buf = Buf & Eight
      Case 9: Buf = Buf & Nine
      Case 10: Buf = Buf & "ten"
      Case 11: Buf = Buf & "eleven"
      Case 12: Buf = Buf & "twelve"
      Case 13: Buf = Buf & "thirteen"
      Case 14: Buf = Buf & "fourteen"
      Case 15: Buf = Buf & "fifteen"
      Case 16: Buf = Buf & "sixteen"
      Case 17: Buf = Buf & "seventeen"
      Case 18: Buf = Buf & "eighteen"
      Case 19: Buf = Buf & "nineteen"
   End Select

   EnglishNumberDigitGroup = Buf

End Function

Your Excel window should look as follows:

Microsoft Excel

Click the Save button (disk icon) and then go back to your spreadsheet window.

You can now use the EnglishNumber function to convert a number to words. It will work just like any other worksheet function. Just reference the EnglishNumber function in your Excel spreadsheet as follows:

Microsoft Excel

Based on the spreadsheet above, the EnglishNumber function will return the following:

=EnglishNumber(1)
Result: "one"

=EnglishNumber(125)
Result: "one hundred twenty-five"

=EnglishNumber(3278)
Result: "three thousand two hundred seventy-eight"

Often you need converting a numeric value into certain language – English (Russian, German, etc.) in Excel. Since by default this program has no ready-made function to make these actions, we will create our custom function using Excel Macros.



Converting a number into text, we need performing three simple steps:

  1. Open the ALT + F11 VBA editor.
  2. Create a new module and write a function in it in a special way: Use “Function” instead of “Sub” there. In this definite case, the function “SpellCurr” will be exposed in Shift+ F3 function – Category: “User Defined”.
  3. Font code 128.

  4. Insert the code into the Module and save it there (be very attentive doing it!):




Function SpellCurr(ByVal MyNumber, _
Optional MyCurrency As String = "Rupee", _
Optional MyCurrencyPlace As String = "P", _
Optional MyCurrencyDecimals As String = "Paisa", _
Optional MyCurrencyDecimalsPlace As String = "S")
'***************************************************'
          Dim Rupees, Paisa, 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 Paisa and set MyNumber to Rupee amount.
          If DecimalPlace > 0 Then
              Paisa = 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 Rupees = Temp & Place(Count) & Rupees
              If Len(MyNumber) > 3 Then
                  MyNumber = Left(MyNumber, Len(MyNumber) - 3)
              Else
                  MyNumber = ""
              End If
              Count = Count + 1
          Loop
            If MyCurrencyPlace = "P" Then
                Select Case Rupees
                    Case ""
                        Rupees = MyCurrency & "s" & " Zero"
                    Case "One"
                        Rupees = MyCurrency & " One"
                    Case Else
                        Rupees = MyCurrency & "s " & Rupees
                End Select
            Else
                Select Case Rupees
                    Case ""
                        Rupees = "Zero " & MyCurrency & "s"
                    Case "One"
                        Rupees = "One " & MyCurrency
                    Case Else
                        Rupees = Rupees & " " & MyCurrency & "s"
                End Select
            End If
          If MyCurrencyDecimalsPlace = "S" Then
                Select Case Paisa
                    Case ""
                        Paisa = " Only"
                    Case "One"
                        Paisa = " and One " & MyCurrencyDecimals & " Only"
                    Case Else
                        Paisa = " and " & Paisa & " " & MyCurrencyDecimals & "s Only"
                End Select
          Else
                Select Case Paisa
                    Case ""
                        Paisa = " Only"
                    Case "One"
                        Paisa = " and " & MyCurrencyDecimals & " One " & " Only"
                    Case Else
                        Paisa = " and " & MyCurrencyDecimals & "s " & Paisa & " Only"
                End Select
          End If
          SpellCurr = Rupees & Paisa
      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

In the settings of the function, you can add your own currency:

Font code 128.

Download converter number to words in Excel

VBA Macro code converts numbers to words. After inserting this code into the macro editor module, we have a new function available as FX button. Now you can quickly “convert” the sum written in numbers into words. To use the ready-made solution, we recommend downloading the following example working with numbers and words in Excel. This file contains the already prepared user-defined function and the VBA code, available in the module from the editor.

There is no built-in formula in excel, you have to add a vb script and permanently save it with your MS. Excel’s installation as Add-In.

  1. press Alt+F11
  2. MENU: (Tool Strip) Insert Module
  3. copy and paste the below code
Option Explicit

Public Numbers As Variant, Tens As Variant

Sub SetNums()
    Numbers = Array("", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen")
    Tens = Array("", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety")
End Sub

Function WordNum(MyNumber As Double) As String
    Dim DecimalPosition As Integer, ValNo As Variant, StrNo As String
    Dim NumStr As String, n As Integer, Temp1 As String, Temp2 As String
    ' This macro was written by Chris Mead - www.MeadInKent.co.uk
    If Abs(MyNumber) > 999999999 Then
        WordNum = "Value too large"
        Exit Function
    End If
    SetNums
    ' String representation of amount (excl decimals)
    NumStr = Right("000000000" & Trim(Str(Int(Abs(MyNumber)))), 9)
    ValNo = Array(0, Val(Mid(NumStr, 1, 3)), Val(Mid(NumStr, 4, 3)), Val(Mid(NumStr, 7, 3)))
    For n = 3 To 1 Step -1    'analyse the absolute number as 3 sets of 3 digits
        StrNo = Format(ValNo(n), "000")
        If ValNo(n) > 0 Then
            Temp1 = GetTens(Val(Right(StrNo, 2)))
            If Left(StrNo, 1) <> "0" Then
                Temp2 = Numbers(Val(Left(StrNo, 1))) & " hundred"
                If Temp1 <> "" Then Temp2 = Temp2 & " and "
            Else
                Temp2 = ""
            End If
            If n = 3 Then
                If Temp2 = "" And ValNo(1) + ValNo(2) > 0 Then Temp2 = "and "
                WordNum = Trim(Temp2 & Temp1)
            End If
            If n = 2 Then WordNum = Trim(Temp2 & Temp1 & " thousand " & WordNum)
            If n = 1 Then WordNum = Trim(Temp2 & Temp1 & " million " & WordNum)
        End If
    Next n
    NumStr = Trim(Str(Abs(MyNumber)))
    ' Values after the decimal place
    DecimalPosition = InStr(NumStr, ".")
    Numbers(0) = "Zero"
    If DecimalPosition > 0 And DecimalPosition < Len(NumStr) Then
        Temp1 = " point"
        For n = DecimalPosition + 1 To Len(NumStr)
            Temp1 = Temp1 & " " & Numbers(Val(Mid(NumStr, n, 1)))
        Next n
        WordNum = WordNum & Temp1
    End If
    If Len(WordNum) = 0 Or Left(WordNum, 2) = " p" Then
        WordNum = "Zero" & WordNum
    End If
End Function

Function GetTens(TensNum As Integer) As String
' Converts a number from 0 to 99 into text.
    If TensNum <= 19 Then
        GetTens = Numbers(TensNum)
    Else
        Dim MyNo As String
        MyNo = Format(TensNum, "00")
        GetTens = Tens(Val(Left(MyNo, 1))) & " " & Numbers(Val(Right(MyNo, 1)))
    End If
End Function

After this, From File Menu select Save Book ,from next menu select
«Excel 97-2003 Add-In (*.xla)

It will save as Excel Add-In. that will be available till the Ms.Office Installation to that machine.

Now Open any Excel File in any Cell type =WordNum(<your numeric value or cell reference>)

you will see a Words equivalent of the numeric value.

This Snippet of code is taken from: http://en.kioskea.net/forum/affich-267274-how-to-convert-number-into-text-in-excel

This article will teach you how to convert a numeric value in a Microsoft Excel worksheet cell into words using what is called the Spell Number function.

How to convert numbers to words in Excel?

  • Without VBA

The first method for converting a number to its written equivalent is to use direct entry. For example, if you were looking to write out 47.75 into forty seven dollars and seventy five cents, you can do this by entering the following formula into a cell:

=SpellNumber(47.75)

  • Insert function

Another way to change numbers to text is to use Insert Function. To do this, select the cell that you want, and then, click Insert Function on the Formulas ribbon.

Under Or, select a category, followed by User Defined. In the Select a function list, select SpellNumber, followed by OK.

Next, enter the number or cell reference that you want, and then click OK.

  • Concatenate function

Alternatively, you can use the Concatenate function to apply this formula to specific cells (though this method is a bit more complicated). To use this function, enter the code below (be sure to replace B6 with the applicable cell number):

=CONCATENATE(TEXT(UPPER(Spell Number(B6)),0),"ONLY")

Need more help with Excel? Check out our forum!

How To Convert Numeric Value Into English Words In Excel – SpellNumber

SpellNumber is a manually created function through VBA Programming to change a number to written text. In other words, it converts a numeric value into English words with currency.

In this article, we will learn step by step how to create this SpellNumber function using the VBA Function.

For example, I have $ 2,345.50 and need to be displayed as “Dollar Two Thousand Three Hundred Forty-Five and Fifty Cents”.

The SpellNumber macro does as its name suggests. We have created a new code with minor changes in currency, calculations, etc. They all are based on the Microsoft code.

There is no direct function in Microsoft Excel to perform the above action. However, as many and many users demanded, they created and published the special VBA macro code on their website.

Steps to create the SpellNumber Function

Step 1: Start Microsoft Excel.

Step 2: Press ALT+F11 to open the Visual Basic Editor.

Step 3: On the Insert menu, click Module.

SpellNumber

Step 4: Copy and Paste the below code into the Module sheet.

Code For SpellNumber


This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters

Show hidden characters

Option Explicit
‘Main Function www.ExcelDataPro.com
Function SpellNumberEDP(ByVal MyNumber, Optional MyCurrency As String = «»)
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
Dim str_amount, str_amounts
Dim str_cent, str_cents
Select Case UCase(MyCurrency)
Case «SAR»
str_amount = «Riyal»
str_amounts = «Riyals»
str_cent = «Halala»
str_cents = «Halalas»
Case «AED»
str_amount = «Dirham»
str_amounts = «Dirhams»
str_cent = «Fil»
str_cents = «Fils»
Case «GBP»
str_amount = «Pound»
str_amounts = «Pounds»
str_cent = «Penny»
str_cents = «Pence»
Case «EUR»
str_amount = «Euro»
str_amounts = «Euros»
str_cent = «Cent»
str_cents = «Cents»
Case «YEN»
str_amount = «Yen»
str_amounts = «Yens»
str_cent = «Sen»
str_cents = «Sens»
Case Else:
str_amount = «Dollar»
str_amounts = «Dollars»
str_cent = «Cent»
str_cents = «Cents»
End Select
Select Case Dollars
Case «»
Dollars = «No « & str_amounts
Case «One»
Dollars = «One « & str_amount
Case Else
Dollars = Dollars & » « & str_amounts
End Select
Select Case cents
Case «»
cents = » and No « & str_cents
Case «One»
cents = » and One « & str_cent
Case Else
cents = » and « & cents & » « & str_cents
End Select
SpellNumberEDP = 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

Step 5: Press Ctrl+S to save the workbook. As this workbook now contains a macro, while saving Excel will display the following message “The following features cannot be saved in macro-free workbook”. Click “No”.

SpellNumber

You will see a new dialog. Select the “Save As” option.

SpellNumber

From the drop-down menu select the “Save as type” as “Excel macro-enabled workbook”.

We are done with creating the function in your workbook. One thing is to be kept in mind that this function will only be available in this workbook.

As you plan to change workbook, it is necessary to paste the code for each workbook by following the above-mentioned steps.

Note: Our workbook now contains a macro. Each time you open this workbook or any other macro-enabled workbook, a security warning will appear below the ribbon. Select the “Enable this content” option and click OK.

SpellNumber

SpellNumber

How To Use the SpellNumber Function?

To display the given number in Dollars, write a number in a cell. Enter the following formula: =SpellNumberEDP(A1).

SpellNumber

It will display the numbers as shown below:

SpellNumber

We have created the code for 5 other currencies; Euro, Japanese Yen, Great Britain Pounds, Saudi Riyals and Uae Dirhams.

Unlike the above, here you need to enter two parameters. one is the SpellNumber function and second is the currency in quote marks. For USD you don’t need to put the second parameter.

The second parameter is different for each currency:

1. SpellNumber European Euro

European Euro = SpellNumberEDP(A1, “EUR”). Applying the parameter will display the numbers in words as displayed below:

SpellNumber European Euros

Result:

SpellNumber European Euros

For more information SpellNumber European Euro.

2. SpellNumber Japanese Yen

Japanese Yen = SpellNumberEDP(A1, “YEN”). Applying the second parameter will display the numbers as given below:

SpellNumber Japanese Yen

Result:

SpellNumber Japanese Yen

For more information SpellNumber Japanese Yen

3. SpellNumber Great Britain Pounds

Great Britain Pound = SpellNumberEDP(A1, “GBP”). Add GBP code in quote marks and it will display the pounds in words.

SpellNumber Great Britain Pound

Result:

SpellNumber Great Britain Pound

For more information SpellNumber Great Britain Pound

4. SpellNumber Saudi Riyal

Saudi Riyal = SpellNumberEDP(A1, “SAR”). Enter the second parameter and it shows as below:

SpellNumber Saudi Riyals

Result:

SpellNumber Saudi Riyals

For more information SpellNumber Saudi Riyal

5. SpellNumber UAE Dirham

UAE Dirhams = SpellNumberEDP(A1, “AED”). Put the send parameter as shown here. It will display the results as given below:

SpellNumber UAE Dirham

Result:

SpellNumber UAE Dirham

For more information SpellNumber UAE Dirham

Please make note that this code is applicable where the currency system is similar to that of dollars. Trillion, Billions, Million, etc are the same.

In such cases, if you want to add another currency, you need to make 5 changes as shown:

SpellNumber

In the above code, instead of “SAR” write your own currency code.

For str_amount write your currency singular unit and for str_amounts write plural currency units. For decimal values write singular decimal values against str_cent and plural against str_cents.

If they are different again the code will be changed. For example; In Indian Currency, it is in lacs and crores instead of trillions, billions or millions. We have also given the made the code for SpellNumber for Indian Rupees.

Click on the link to get the code: SpellNumber Indian Rupees

We thank our readers for liking, sharing and following us on different social media platforms.

If you have any queries please share in the comment section below. I will be more than happy to assist you.

Behold… Pete’s creation!!!!!!!!!!

DON’T RUN AWAY JUST YET!

Don’t worry if this looks a bit intimidating; you don’t need to understand this to use it.  We only need to know how to integrate it into our spreadsheets.

SCROLL DOWN TO DOWNLOAD THE WORKBOOK & CHECK OUT THE POWER QUERY SOLUTION TO THIS (sent to us by our wonderful community)

Let’s look at some examples

This formula is quite complex, having to account for such instances of where it sees values such as “Eleven” (as opposed to “One and One”), “Twenty”, “Thirty”, and weather to say things like “Hundred” versus “Hundred and” something.

The combination of numbers to words can be quite daunting.

Changing the Currency and Decimal Usage

Suppose you need to update this formula to work with US dollars and you don’t require the decimal places.

If you look at the very end of the formula, you will see the portion that is responsible for the decimal places.

&RIGHT(TEXT(B3,"000000000.00"),2)&"/100"

If you do not require decimal places to be displayed, erase this portion of the formula.

For the currency type, change the portion labeled “Euro” to “USD” or “CAD” or whatever currency designation you wish.

Let’s see how that appears after our little formula tweak.

How to apply the formula to many cells

Suppose you have a spreadsheet and you wish to enter a number in cell B4 and have the formula answer appear in the cell directly to the right in cell C4.

We need to make sure that none of the cell references change when copying the formula to a new location.

  1. Place your cursor on the cell holding the original formula and press F2 to enable edit mode (or click in the Formula Bar).
  2. Select the entire formula by pressing CTRL-A (or manually highlighting the formula. CTRL-A is faster and more accurate.)
  3. Press CTRL-C to copy the formula.
  4. Press the ESC (Escape) key to back out of edit mode.
  5. Switch to the location and cell you wish to use this formula and press F2 to enable edit mode.
  6. Press CTRL-V to paste the formula into the new cell.

We’re not quite there yet because all the cell references are pointing to cell B3.  If your data entry cell is in fact cell B3, you are ready to go.  If not, we need to update the cell references to point to the proper data entry location.

Because our original formula was looking at cell B3 for the number and we wish to enter our number in cell B4, we will now perform the following steps to adjust our cell references:

  1. Place your cursor on the cell holding the pasted formula and press F2 to enable edit mode (or click in the Formula Bar).
  2. Remove the equals sign (=) from the beginning of the formula.
  3. Press ENTER. We now have just a massive amount of text in the cell.
  4. Press CTRL-H to open the Find/Replace dialog box.
  5. In the “Find what:” field, enter “B3” (no double-quotes).
  6. In the “Replace with:” field, enter “B4” (no double-quotes).
  7. Press the “Replace All” button.

Restore the equals sign to the beginning of the formula from where we removed it earlier in step 2.

Running it through some tests

To test the formula quickly and over multiple iterations, select cell B4 and enter the following formula.

=RANDBETWEEN(1,2000000)

This formula will generate a random number between 1 and 2-million each time the sheet recalculates.

You can force a recalculation by pressing the F9 key on the keyboard or pressing Formulas (tab) -> Calculation (group) -> Calculate Now.

To see several examples simultaneously, select cells B4 and C4 and pull the Fill Series handle down several rows.  This will generate several random numbers and their text counterparts.

Bonus Modification

If you decide to not display the fractional side of the number, the above modification simply removes the fractional values without any rounding operation.

If you would like to round the input to the nearest whole number, implement the following steps:

  1. Place your cursor on the cell holding the pasted formula and press F2 to enable edit mode (or click in the Formula Bar).
  2. Remove the equals sign (=) from the beginning of the formula.
  3. Press ENTER. We now have just a massive amount of text in the cell.
  4. Press CTRL-H to open the Find/Replace dialog box.
  5. In the “Find what:” field, enter “B3” (no double-quotes).
  6. In the “Replace with:” field, enter “ROUND(B3,0)” (no double-quotes).
  7. Press the “Replace All” button.

Restore the equals sign to the beginning of the formula from where we removed it earlier in step 2.

Don’t forget to change the B3 reference to whichever cell you are performing the data entry.

Are you curious as to how all this works?

This formula relies on the use of four key functions:

  • LEFT
  • MID
  • TEXT
  • CHOOSE

It’s not necessary to dissect every component of the formula, we only need to decipher the first bit highlighted below.

CHOOSE(LEFT(TEXT(B3),"000000000.00"))+1,,"One","Two","Three",
"Four","Five","Six","Seven","Eight","Nine")
&IF(--LEFT(TEXT(B3),"000000000.00"))=0,,IF(AND(--MID(TEXT(B3),"000000000.00"),
2,1)=0,--MID(TEXT(B3),"000000000.00"),3,1)=0)," Hundred"," Hundred and "))

Once we have this portion figured out we’ll be able to figure out the remainder of the formula since it is very much a repeated operation.

The LEFT Function

The purpose of the LEFT function is to extract a specific number of characters from the text starting from the left side.  The structure of the LEFT function is as follows.

=LEFT(text, [num_chars])

The parameter “text” refers to the cell holding the input, while “[num_chars]” indicates the number of characters to extract.  Because the “[num_chars]” parameter is optional, skipping this parameter will result in a default extraction of 1 character.

The MID Function

The purpose of the MID function is to extract a specific number of characters from the text starting from a specific character position (counting from the left side).  The structure of the MID function is as follows.

=MID(text, start_num, num_chars)

The parameter “text” refers to the cell holding the input; the parameter “start_num” indicates the position to begin text extraction (counting from the left side), while “num_chars” indicates the number of characters to extract.

The TEXT Function

The purpose of the TEXT function is to represent a cell’s information with specific formatting.  The structure of the TEXT function is as follows.

=TEXT(value, format_text)

Normally, formatting is applied to a cell through traditional cell formatting controls.

The TEXT function applies formatting (fancy word alert) formulaically. This way, we can change the formatting of information dynamically based on the need of the moment.

EXAMPLE:  Suppose you have a calculation that needs to reflect U.S. Dollars or Euros depending on a country selection.  The formula could look something like the following:

=IF(Country=”USA”, TEXT(Sale, ”$#,##0.00”), TEXT(Sale, “€#,##0.00”))

If the user selects USA (cell A2) , they get the total sales represented by a “$” sign (cell C4) .  If the user selects any other country, the total sales is represented by a “” symbol.

This function relies on a cell named “Country” (cell A2) where a user may select a country from a Data Validation dropdown list, and a cell named “Sale” (cell A9) that may hold something like a SUM function that adds all the sales together.

In our specific example, the function…

=TEXT(B3,”000000000.00”)

…pads the input number with leading zeroes.  By counting the leading zeroes, the formula will be able to determine if the number is in the hundreds, thousands, or millions.

If a user inputs a number, such as 123456.78, the TEXT function will interpret the number as 000123456.78.  The three leading zeroes indicates a number in the thousands.

The CHOOSE Function

The CHOOSE function is used to simplify multiple nested IF functions that are examining the same data.  CHOOSE is especially useful when working with indexes.

The purpose of the CHOOSE function is to select a value from a built-in list of values based on a supplied number.

=CHOOSE(index_num, value1, [value2], …)

If we were to extract the first (left-most) number from the input number and give it to the following CHOOSE function, what do you think we would get back from the CHOOSE function?

=CHOOSE(LEFT(B3), “One”, “Two”, “Three”, “Four”, “Five”, “Six”, “Seven”, 
“Eight”, “Nine”)

We would see the word version of the extracted number.  “2” would yield “Two”, “5” would yield “Five”, etc…

Putting it All Together

In the formula, we are combining all the functions into a single formula, each function performing their respective parts to accomplish the mission.

CHOOSE(LEFT(TEXT(B3,"000000000.00"))+1,,"One","Two","Three",
"Four","Five","Six","Seven","Eight","Nine")
&IF(--LEFT(TEXT(B3,"000000000.00"))=0,,IF(AND(--MID(TEXT(B3,"000000000.00"),
2,1)=0,--MID(TEXT(B3,"000000000.00"),3,1)=0)," Hundred"," Hundred and "))

First we use the TEXT function to turn the number into a “000000000.00” format.

TEXT(B3,"000000000.00")

Then, we extract the left-most character form the number.

LEFT(TEXT(B3,"000000000.00"))

This will allow us to determine if the returned number is a zero or any other value.  This will indicate weather or not our number is in the “millions” range.

Next, we CHOOSE how to represent the extracted value.

CHOOSE(LEFT(TEXT(B3,"000000000.00"))+1,,"One","Two","Three",
"Four","Five","Six","Seven","Eight","Nine")

We then check to see if the value is a zero.

CHOOSE(LEFT(TEXT(B3,"000000000.00"))+1,,"One","Two","Three",
"Four","Five","Six","Seven","Eight","Nine")
&IF(--LEFT(TEXT(B3,"000000000.00"))=0,,

If the value is a zero, then we are not in the millions so we will display nothing.

If the next two digits are zero, then we will display “Hundred”; otherwise, we will display “Hundred and”.

CHOOSE(LEFT(TEXT(B3,"000000000.00"))+1,,"One","Two","Three","Four",
"Five","Six","Seven","Eight","Nine")
&IF(--LEFT(TEXT(B3,"000000000.00"))=0,,IF(AND(--MID(TEXT(B3,"000000000.00"),
2,1)=0,--MID(TEXT(B3,"000000000.00"),3,1)=0)," Hundred"," Hundred and "))

That’s It!

This formula doesn’t rely on any

  • VBA
  • CTRL-Shift-Enter Array Formulas, or
  • Helper Cells

Thank you, Pete for sharing your formula with the Excel community.  I’m certain many will find your solution both creative and highly useful.

Practice Workbook

Feel free to Download the Workbook HERE.

Excel Download Practice file

Many thanks to Jim M. for updating the formula for US syntax, Zafar for updating it for billions as well as text as decimal places!
Also many thanks to Abdul Rahman Mohammed for providing the Qatari Riyals (QAR), Indian Rupees (INR) & Bahraini Dinars (BHD) in both absolute and rounded figures.

The reworked versions are available in the downloadable Workbook.

Power Query Solution!

A Power Query solution of transforming numbers to works was sent to us by Kunle SOPEJU.

Check out his Power Query solution HERE.

Excel Download Practice file

Many thanks to Kunle SOPEJU for letting us get creative with Power Query!

Published on: May 16, 2019

Last modified: March 1, 2023

Microsoft Most Valuable Professional

Leila Gharani

I’m a 5x Microsoft MVP with over 15 years of experience implementing and professionals on Management Information Systems of different sizes and nature.

My background is Masters in Economics, Economist, Consultant, Oracle HFM Accounting Systems Expert, SAP BW Project Manager. My passion is teaching, experimenting and sharing. I am also addicted to learning and enjoy taking online courses on a variety of topics.

We can sum text values asnumbers after we have ASSIGNED NUMBERS to the Values. We can do this with the INDEX, MATCH, and SUM functions. This is useful for the evaluation of a questionnaire. The steps below will walk you through the procedure.

How to assign values to words in Excel

Figure 1: How to Sum Text Values As Numbers

Setting up the Data

  • We will input the names of five students as shown in figure 2 into Column A from Cell A4 to Cell A8
  • We will input their replies to the questions in Cell B4 to Cell E8 as shown in figure 2
  • Cell F3 will be named as TOTAL VALUE
  • We will assign numbers to each of the replies as shown in Column B from Cell B10 to Cell B14. The numbers are in Cell C10 to Cell C14

How to assign values to words in Excel

Figure 2: Setting up the Data

General Formula

=SUM(INDEX(Value,N(IF(1,MATCH(Code,0)))))

Explanation

The functions that enable the translation of the ALPHABETS or TEXTS to NUMBERS are the INDEX and MATCH functions. The N and IF functions are required to ensure that we get results for the entire row. A shorter stream of functions will result in producing values for just a set of alphabets or text.

Sum Text Values As Numbers

We will sum the reply of Jude by doing the following:

  • We will click on Cell F4 and input the formula below:

=SUM(INDEX(C10:C14,N(IF(1,MATCH(B4:E4,B10:B14,0)))))

How to assign values to words in Excel

Figure 3: Sum Text Values As Numbers

  • We will press the following keys to get the result, CRTL+SHIFT+ENTER

How to assign values to words in Excel

Figure 4: Sum Text Values As Numbers

Instant Connection to an Expert through our Excelchat Service

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

Понравилась статья? Поделить с друзьями:
  • Value in excel hide
  • Value if true value if false excel
  • Value hidden in excel
  • Value from text excel
  • Value from combobox vba excel