+ Reply to Thread
Results 1 to 21 of 21

Convert number to written words

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,666

    Convert number to written words

    Hi,

    I am working on a vba program and one of the things i want to do is convert say a number like
    98261.15

    to written word like this

    Ninety Eight thousand two Hundred Sixty One and 15 cents

    Does anyone know how to do this?

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: Convert number to written words

    .
    This is one method :

    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,666

    Re: Convert number to written words

    Hi , how does the number to words work.....when i try to run this no macro shows up to run.

  4. #4
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,666

    Re: Convert number to written words

    oh i see now....both are "functions" that one can create in excel...........i see thanks...i will take a look

  5. #5
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,420

    Re: Convert number to written words

    Here is another function that I posted in my mini-blog article here that you can consider (one of its modes outputs dollars and cents, but if you need the "dollars" removed, I can do that for you)...

    Yet Another Number-To-Words Function (Sorry, US Style Only)

    Note: The function at the link above is capable of handling an absolutely huge number (passed into it as a text string), much larger than almost anyone would ever need (a fraction less than a quintillion... that is a number with 18 digits in front of the decimal point!).
    Last edited by Rick Rothstein; 06-09-2020 at 04:06 PM.

  6. #6
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,666

    Re: Convert number to written words

    question: about the declaration in the spellnum function

    Please Login or Register  to view this content.
    if i wanted to "remove" the user defined function and use this code to convert to words in my actual code.........

    what is the "ByVal MyNumber" declaration.........is it a long variable or something else?

  7. #7
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,420

    Re: Convert number to written words

    Quote Originally Posted by welchs101 View Post
    if i wanted to "remove" the user defined function and use this code to convert to words in my actual code.........
    Why? You gain absolutely nothing by doing that and probably cause all kind of problems by trying to integrate this particular function into your existing code. Simply place the function code into a module and when you need to do the conversion, call the function and let it do its thing.

    While I am guessing you are happy with the function previously posted, I just wanted to point out the message I posted in Message #5 (you may have missed it as you were posting your last message at almost the same time I posted mine).

  8. #8
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,666

    Re: Convert number to written words

    ok.... so if i want to use it in my code just call the function like you said...got it.

    also, you mentioned that the value i pass is a "text string" and 'NOT' a number....is this right?

  9. #9
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,666

    Re: Convert number to written words

    One more question.....is there a way to pass it the varibles like instead of "Dollar" replace with "Euro"?

  10. #10
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,420

    Re: Convert number to written words

    Quote Originally Posted by welchs101 View Post
    also, you mentioned that the value i pass is a "text string" and 'NOT' a number....is this right?
    If the number is not converted to exponential notation (less than 11 digits on a worksheet, less than 16 digits within the VBA world), you can pass the number into the function as a number or text string, otherwise it must be passed as a text string (to avoid having Excel or VBA convert it exponential notation before the code can see all the digits).



    Quote Originally Posted by welchs101 View Post
    One more question.....is there a way to pass it the varibles like instead of "Dollar" replace with "Euro"?
    I could modify the program to do that if you wish, but you could also simply pass the output from my function into VBA's Replace function or Excel's SUBSTITUTE function (depending on where you are calling my functon from) and do the text replacement that way.

  11. #11
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,666

    Re: Convert number to written words

    as far as updating the program i think i will do as you suggested and just do a replace type thing. I think that will work fine.

    regarding the "exponential" thing you mentioned................ah i am not sure what you're talking about. i will look up exponential notation for excel now.

  12. #12
    Forum Contributor
    Join Date
    04-15-2013
    Location
    Singapore, Melbourne
    MS-Off Ver
    Office 365
    Posts
    167

    Re: Convert number to written words

    Row row row your boat
    Gently down the stream

  13. #13
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,666

    Re: Convert number to written words

    so when i think of exponential notation i think of scientific notation.........and i dont think this is what you were talking about...right?

  14. #14
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,420

    Re: Convert number to written words

    Quote Originally Posted by welchs101 View Post
    so when i think of exponential notation i think of scientific notation.........and i dont think this is what you were talking about...right?
    Same idea. To see what I mean, type 12 digits into a cell in Excel and then hit the Enter Key... note your original 12 digits have been converted to exponential format (same thing happens in VBA, you just get more specify more digits before that happens). Unfortunately, if you do not make your long numbers text, the exponential numbers is what my function recieves.

  15. #15
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,666

    Re: Convert number to written words

    i can get it to work for up to 15 characters....any more than that and it does not work. I did not see the exponential thing you mentioned.

  16. #16
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,666

    Re: Convert number to written words

    i see what you're saying now.....i went to one of the other files you sent me and when i typed in 13 digit number it converted it to scientific notation and the program does not work with such a thing.

    is there a way to get the program to work with regardless with the number displayed?

  17. #17
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,666

    Re: Convert number to written words

    One thing i did figure out is this. If you format the cell that the number is in as a "Number" instead of "General" then the scientific notation does not seem to occur.

    But i wish i did not even have to do this.

  18. #18
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,420

    Re: Convert number to written words

    Quote Originally Posted by welchs101 View Post
    ...and when i typed in 13 digit number it converted it to scientific notation and the program does not work with such a thing.

    is there a way to get the program to work with regardless with the number displayed?
    The Number format may not be the answer (depending on how many digits you number has) as Excel will covert any digits after the 15th digit to zeros. Formatting the cell as Text allows the function to see all of the digits and process them.

  19. #19
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,666

    Re: Convert number to written words

    Not sure if this applies to this thread or if i need to start another but i will post here and see where it goes.

    Convert number to written words for ENGLISH works good enough.
    Does anyone know of the same type of thing for Russian?

    I am making something where i need both English and Russian written word to describe a numeric value.

    Any one know of a Russian version of this?

  20. #20
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,420

    Re: Convert number to written words

    I do not know how to read or speak Russian, so I cannot help. My guess is that you would be better served starting a new thread for a Russian number to text function as any one who might know how to write such code is probably not reading this thread any more (if they even did so initially), so a new thread might grab their attention.

  21. #21
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: Convert number to written words

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Convert number to words
    By Sanga Fanai in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-01-2018, 07:55 AM
  2. [SOLVED] Convert number to words
    By abdumon7 in forum Excel General
    Replies: 7
    Last Post: 11-23-2017, 06:22 AM
  3. How to convert number into words
    By Terressa in forum Excel General
    Replies: 3
    Last Post: 06-23-2015, 03:24 AM
  4. [SOLVED] Convert Number to Words
    By SMILE in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-07-2013, 01:24 AM
  5. How to express a number in the corresponding value written in words
    By Romoluzzi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-21-2010, 06:45 AM
  6. Convert Number into Words
    By Sunil S Gawde \(INDIA\) in forum Excel General
    Replies: 5
    Last Post: 04-08-2005, 05:40 AM
  7. number convert into words
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-15-2005, 12:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1