Share via

want to add spell number formula in excel plz help

Anonymous
2024-12-03T16:33:02+00:00

want to add spell number formula in excel plz help

Microsoft 365 and Office | Excel | Other | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. Reported
    Anonymous
    2024-12-04T10:12:55+00:00

    Hi NitinKumar Rohit

    Thank you for using Microsoft products and posting in the community.

    I know you've encountered a excel issue.

    Excel does not have such function for the time being, you can use VBA macro to create custom function. Here are the steps on how to add English spelling numbers in Excel:

    1. Create VBA macros to convert numbers to English spelling

    Steps:

    Open the Excel file.

    Press Alt + F11 to open the VBA editor.

    In the VBA editor, click Insert -> Module in the upper left corner.

    Paste the following code into the module:

    Function NumToWords(ByVal MyNumber)
    
      Dim Units As String
    
      Dim SubUnits As String
    
      Dim TempStr As String
    
      Dim DecimalSeparator As String
    
      Dim DecimalSeparatorPos As Integer
    
      Dim DecimalPlace As Integer
    
      Dim i As Integer
    
      Dim TempStr2 As String
    
      Dim Num As Double
    
      Dim ChnUnit As String
    
      Dim ChnNum As String
    
      Dim NumArray As Variant
    
      Dim UnitArray As Variant
    
      Num = MyNumber
    
      NumArray = Array("", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", _
    
                       "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", _
    
                       "Eighteen", "Nineteen", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", _
    
                       "Eighty", "Ninety")
    
      UnitArray = Array("", "Thousand", "Million", "Billion", "Trillion")
    
      TempStr = ""
    
      DecimalSeparator = "."
    
      DecimalSeparatorPos = InStr(1, MyNumber, DecimalSeparator)
    
      If DecimalSeparatorPos > 0 Then
    
          SubUnits = Mid(MyNumber, DecimalSeparatorPos + 1, Len(MyNumber))
    
          MyNumber = Left(MyNumber, DecimalSeparatorPos - 1)
    
      End If
    
      TempStr2 = ""
    
       i = 0
    
      If MyNumber = 0 Then
    
          TempStr2 = "Zero"
    
      End If
    
      Do While MyNumber > 0
    
          TempStr = ""
    
          TempNum = Int(MyNumber Mod 1000)
    
          If TempNum > 0 Then
    
              If TempNum > 99 Then
    
                   TempStr = NumArray(Int(TempNum / 100)) & " Hundred "
    
                   TempNum = TempNum Mod 100
    
              End If
    
              If TempNum > 20 Then
    
                   TempStr = TempStr & NumArray(Int(TempNum / 10) + 18) & " "
    
                   TempNum = TempNum Mod 10
    
              End If
    
              If TempNum > 0 Then
    
                   TempStr = TempStr & NumArray(TempNum) & " "
    
              End If
    
              TempStr2 = TempStr & UnitArray(i) & " " & TempStr2
    
          End If
    
          MyNumber = Int(MyNumber / 1000)
    
          i = i + 1
    
      Loop
    
      NumToWords = Trim(TempStr2)
    
    End Function
    

    Remember to save the code, and then enter the function = NumToWords( xx ) in the excel sheet.

    Hope this helps, let me know if this is contrary to what you need.

    Sincere greetings.

    Petter.Y - MSFT | Microsoft Community Support Specialist.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2024-12-05T05:23:37+00:00

    Hi NitinKumar Rohit

    Does this function meet your requirements?

    Please feel free to post if you have questions.

    Sincere greetings.

    Petter.Y - MSFT | Microsoft Community Support Specialist.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments