Skip to main content

Posts

Showing posts from August, 2023

How to Convert Numbers to Words in Excel

How to Convert Numbers to Words in Excel format Cell _(#,##0.00_);[Red](#,##0.00) = CHOOSE(LEFT(TEXT(B3,"000000000000.00"))+1,,"One ","Two ","Three ","Four ","Five ","Six ","Seven ","Eight ","Nine ")&IF(--LEFT(TEXT(B3,"000000000000.00"))=0, ,IF(AND(--MID(TEXT(B3,"000000000000.00"),2,1)=0,--MID(TEXT(B3,"000000000000.00"),3,1)=0),"Hundred ","Hundred and "))&CHOOSE(MID(TEXT(B3,"000000000000.00"),2,1)+1,,,"Twenty ","Thirty ","Forty ","Fifty ","Sixty ","Seventy ","Eighty ","Ninety ")&IF(--MID(TEXT(B3,"000000000000.00"),2,1)<>1,CHOOSE(MID(TEXT(B3,"000000000000.00"),3,1)+1,,"One ","Two ","Three ","Four ","Five ","Six ","Seven ","Eight ",&quo

Convert numbers into words

  Create the SpellNumber function to convert numbers to words 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. Click the  Insert  tab, and click  Module . 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 = G