In my previous article, I had explained how to convert a number to words in Excel using VBA. I had written a number of code lines to achieve this. But I had never imagined that we can convert numbers to words by just using excel formulas. But one of our Excelforum users did it. I had never imagined that we could convert numbers into words.
This formula is used to convert a number into American currency. This formula can convert numbers from range cents to billions. The number can have two decimal places too.
This user with Id HaroonSid wrote a crazy formula. The formula is a page long and if I will mention it here now, it will cover the whole post. So, I have mentioned it at the end of the post. You can download the excel file below to check the formula.
The formula is too long to explain but I can explain the logic. This formula determines how long the number is. Then it uses the CHOOSE function to substitute numbers with the words. But this is not that easy. This formula Identifies once, tens, hundreds, thousands, millions and billions. It identifies which number comes in which section. Another complexity is this. The number 12 can be one or two in large numbers or Twelve. This adds up to a lot of complexity. But this man was able to solve this complexity and make this formula work efficiently.
So now I am mentioning the formula. This formula applies to B2. Any number written in B2 will be converted into words. This formula converts numbers into american currency dollars, but you can adjust it to convert into any currency or unit by just finding and replacing "Dollars" and "Cents". For example, if you want to convert numbers to Indian Rupee and Paise just find and replace.
So hold your chair. Here's the formula.
Formula to Convert Number to Words:
=IF(OR(LEN(FLOOR(B2,1))=13,FLOOR(B2,1)<=0),"Out of range",PROPER(SUBSTITUTE(CONCATENATE(CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),1,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "),CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),2,1)+1,"",CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),3,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"),IF(VALUE(MID(TEXT(INT(B2),REPT(0,12)),2,1))>1,CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),3,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),IF(VALUE(MID(TEXT(INT(B2),REPT(0,12)),2,1))=0,CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),3,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")),IF(B2>=10^9," billion ",""),CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),4,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "),CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),5,1)+1,"",CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),6,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"),IF(VALUE(MID(TEXT(INT(B2),REPT(0,12)),5,1))>1,CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),6,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),IF(VALUE(MID(TEXT(INT(B2),REPT(0,12)),5,1))=0,CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),6,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")),IF(VALUE(MID(TEXT(INT(B2),REPT(0,12)),4,3))>0," million ",""),CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),7,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "),CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),8,1)+1,"",CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),9,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"),IF(VALUE(MID(TEXT(INT(B2),REPT(0,12)),8,1))>1,CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),9,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),IF(VALUE(MID(TEXT(INT(B2),REPT(0,12)),8,1))=0,CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),9,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")),IF(VALUE(MID(TEXT(INT(B2),REPT(0,12)),7,3))," thousand ",""),CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),10,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "),CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),11,1)+1,"",CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),12,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"),IF(VALUE(MID(TEXT(INT(B2),REPT(0,12)),11,1))>1,CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),12,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),IF(VALUE(MID(TEXT(INT(B2),REPT(0,12)),11,1))=0,CHOOSE(MID(TEXT(INT(B2),REPT(0,12)),12,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")))," "," ")&IF(FLOOR(B2,1)>1," dollars"," dollar"))&IF(ISERROR(FIND(".",B2,1)),""," and "&PROPER(IF(LEN(LEFT(TRIM(MID(SUBSTITUTE(Sheet1!B2,".",REPT(" ",255)),255,200)),2))=1,CHOOSE(1*LEFT(TRIM(MID(SUBSTITUTE(Sheet1!B2,".",REPT(" ",255)),255,200)),2),"ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety")&" cents","")&CONCATENATE(CHOOSE(MID(TEXT(INT(LEFT(TRIM(MID(SUBSTITUTE(Sheet1!B2,".",REPT(" ",255)),255,200)),2)),REPT(0,12)),11,1)+1,"",CHOOSE(MID(TEXT(INT(LEFT(TRIM(MID(SUBSTITUTE(Sheet1!B2,".",REPT(" ",255)),255,200)),2)),REPT(0,12)),12,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen")&" cents","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"),IF(VALUE(MID(TEXT(INT(LEFT(TRIM(MID(SUBSTITUTE(Sheet1!B2,".",REPT(" ",255)),255,200)),2)),REPT(0,12)),11,1))>1,CHOOSE(MID(TEXT(INT(LEFT(TRIM(MID(SUBSTITUTE(Sheet1!B2,".",REPT(" ",255)),255,200)),2)),REPT(0,12)),12,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine")&" cents",IF(LEFT(TRIM(MID(SUBSTITUTE(Sheet1!B2,".",REPT(" ",255)),255,200)),2)="01","one cent",IF(LEFT(TRIM(MID(SUBSTITUTE(Sheet1!B2,".",REPT(" ",255)),255,200)),1)="0",CHOOSE(MID(TEXT(INT(LEFT(TRIM(MID(SUBSTITUTE(Sheet1!B2,".",REPT(" ",255)),255,200)),2)),REPT(0,12)),12,1)+1,"","one","two","three","four","five","six","seven","eight","nine")&" cents",""))))))) |
So yeah, this is the formula. How do you like it? I hope it is useful to you. If you don't want to use this, use the VBA method to convert numbers to words. If you have any doubts regarding this article or if you have any other Excel related questions, ask that too in the comments section below.
Related Articles:
How to Convert Number to Words in Excel in Rupees : We can create a custom Excel formula to convert numbers to words in Indian rupees. I have created this custom function to convert numbers to words in terms of Indian rupees. You can download the macro file
13 Methods of How to Speed Up Excel | Excel is fast enough to calculate 6.6 million formulas in 1 second in Ideal conditions with normal configuration PC. But sometimes we observe excel files doing calculation slower than snails. There are many reasons behind this slower performance. If we can Identify them, we can make our formulas calculate faster.
Center Excel Sheet Horizontally and Vertically on Excel Page : Microsoft Excel allows you to align worksheet on a page, you can change margins, specify custom margins, or center the worksheet horizontally or vertically on the page. Page margins are the blank spaces between the worksheet data and the edges of the printed page
Split a Cell Diagonally in Microsoft Excel 2016 : To split cells diagonally we use the cell formatting and insert a diagonally dividing line into the cell. This separates the cells diagonally visually.
How do I Insert a Check Mark in Excel 2016 : To insert a checkmark in Excel Cell we use the symbols in Excel. Set the fonts to wingdings and use the formula Char(252) to get the symbol of a check mark.
How to disable Scroll Lock in Excel : Arrow keys in excel move your cell up, down, Left & Right. But this feature is only applicable when Scroll Lock in Excel is disabled. Scroll Lock in Excel is used to scroll up, down, left & right your worksheet not the cell. So this article will help you how to check scroll lock status and how to disable it?
What to do If Excel Break Links Not Working : When we work with several excel files and use formula to get the work done, we intentionally or unintentionally create links between different files. Normal formula links can be easily broken by using break links option.
Popular Articles:
50 Excel Shortcuts to Increase Your Productivity | Get faster at your task. These 50 shortcuts will make you work even faster on Excel.
How to use Excel VLOOKUP Function| This is one of the most used and popular functions of excel that is used to lookup value from different ranges and sheets.
How to use the Excel COUNTIF Function| Count values with conditions using this amazing function. You don't need to filter your data to count specific value. Countif function is essential to prepare your dashboard.
How to Use SUMIF Function in Excel | This is another dashboard essential function. This helps you sum up values on specific conditions.
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.