Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

convert number to text

I have been using Pages to print my checks (nice & neat) and using a Numbers spreadsheet as a database to keep track of information like the appropriate account number to go with the "Pay to the Order of"


Everything is fairly easy, except for having to write out the money amount in text! Currently, I have just been having a list of all of the possible words (One, Two, Ten, Hundred etc.) and pasting them in as needed. Is there some way that Pages or Numbers can convert a number to text? I would like to be able to say $150.10 and change to "One Hundred Fifty Dollars and 10/100." Obviously, I would only need to change the 150 part, but I could work around that.

Posted on Sep 10, 2017 8:06 AM

Reply
Question marked as Best reply

Posted on Sep 10, 2017 10:18 AM

Pages and Numbers alone haven't a clue about numbers to words. However, there is some coded AppleScript solutions available.


  • Check Writer (iWorkCommunity) free

    Downloads as a iWork '09 v2.3 template, but one can rename the extension to .numbers and use it directly. Opens in Numbers v3.6.2, but haven't tested it there, or in Numbers v4.2.

  • Yvan Koenig's solution in AppleScript (long) for Numbers '09 v2.3 (free)

    Patch for above from SGIII for Numbers v3.1

  • My AppleScript/Ruby solution below that was adapted from a stackoverflow post.

    Copy/paste the code into the Script Editor (launchpad : Other : Script Editor


-- n2w.applescript -- Given an integer, change it to English words -- e.g. 157 becomes one hundred fifty-seven. -- Ruby code from NoNonsense post on stackoverflow -- https://stackoverflow.com/questions/19445003/using-ruby-convert-numbers-to-words use scripting additions set money to 157 as integer set nbr_words to nbr2words(money) as text display dialog nbr_words return on nbr2words(n) -- convert integer in English words, and return that string. return do shell script "ruby <<'EOF' - " & n & " #!/usr/bin/ruby # coding: UTF-8 def in_words(int) numbers_to_name = { 1000000 => 'million', 1000 => 'thousand', 100 => 'hundred', 90 => 'ninety', 80 => 'eighty', 70 => 'seventy', 60 => 'sixty', 50 => 'fifty', 40 => 'forty', 30 => 'thirty', 20 => 'twenty', 19 => 'nineteen', 18 => 'eighteen', 17 => 'seventeen', 16 => 'sixteen', 15 => 'fifteen', 14 => 'fourteen', 13 => 'thirteen', 12 => 'twelve', 11 => 'eleven', 10 => 'ten', 9 => 'nine', 8 => 'eight', 7 => 'seven', 6 => 'six', 5 => 'five', 4 => 'four', 3 => 'three', 2 => 'two', 1 => 'one' } str = '' numbers_to_name.each do |num, name| return str if int.zero? return str + name.to_s if int.to_s.length == 1 && int / num > 0 return str + name.to_s if (int % num).zero? return str + name.to_s + '-' + in_words(int % num) \\ if int < 100 && int / num > 0 if (int / num) > 0 return str + in_words(int / num) + ' ' + name.to_s + ' ' + \\ in_words(int % num) end end end val = ARGV.join.to_i puts in_words(val) EOF" end nbr2words

11 replies
Question marked as Best reply

Sep 10, 2017 10:18 AM in response to saxman1.586

Pages and Numbers alone haven't a clue about numbers to words. However, there is some coded AppleScript solutions available.


  • Check Writer (iWorkCommunity) free

    Downloads as a iWork '09 v2.3 template, but one can rename the extension to .numbers and use it directly. Opens in Numbers v3.6.2, but haven't tested it there, or in Numbers v4.2.

  • Yvan Koenig's solution in AppleScript (long) for Numbers '09 v2.3 (free)

    Patch for above from SGIII for Numbers v3.1

  • My AppleScript/Ruby solution below that was adapted from a stackoverflow post.

    Copy/paste the code into the Script Editor (launchpad : Other : Script Editor


-- n2w.applescript -- Given an integer, change it to English words -- e.g. 157 becomes one hundred fifty-seven. -- Ruby code from NoNonsense post on stackoverflow -- https://stackoverflow.com/questions/19445003/using-ruby-convert-numbers-to-words use scripting additions set money to 157 as integer set nbr_words to nbr2words(money) as text display dialog nbr_words return on nbr2words(n) -- convert integer in English words, and return that string. return do shell script "ruby <<'EOF' - " & n & " #!/usr/bin/ruby # coding: UTF-8 def in_words(int) numbers_to_name = { 1000000 => 'million', 1000 => 'thousand', 100 => 'hundred', 90 => 'ninety', 80 => 'eighty', 70 => 'seventy', 60 => 'sixty', 50 => 'fifty', 40 => 'forty', 30 => 'thirty', 20 => 'twenty', 19 => 'nineteen', 18 => 'eighteen', 17 => 'seventeen', 16 => 'sixteen', 15 => 'fifteen', 14 => 'fourteen', 13 => 'thirteen', 12 => 'twelve', 11 => 'eleven', 10 => 'ten', 9 => 'nine', 8 => 'eight', 7 => 'seven', 6 => 'six', 5 => 'five', 4 => 'four', 3 => 'three', 2 => 'two', 1 => 'one' } str = '' numbers_to_name.each do |num, name| return str if int.zero? return str + name.to_s if int.to_s.length == 1 && int / num > 0 return str + name.to_s if (int % num).zero? return str + name.to_s + '-' + in_words(int % num) \\ if int < 100 && int / num > 0 if (int / num) > 0 return str + in_words(int / num) + ' ' + name.to_s + ' ' + \\ in_words(int % num) end end end val = ARGV.join.to_i puts in_words(val) EOF" end nbr2words

Sep 16, 2017 11:02 AM in response to PeterBreis0807

Peter, you are in violation of the "Apple Support Communities Use Agreement"


Apple Support Communities Use Agreement


Specifically #2.2 & 2.3:


  1. Be polite. Everyone should feel comfortable reading Submissions and participating in discussions. Apple will not tolerate flames or other inappropriate statements, material, or links. Most often, a "flame" is simply a statement that is taunting and thus arbitrarily inflammatory. However, this also includes those which are libelous, defamatory, indecent, harmful, harassing, intimidating, threatening, hateful, objectionable, discriminatory, abusive, vulgar, obscene, pornographic, sexually explicit, or offensive in a sexual, racial, cultural, or ethnic context.
  2. Post constructive comments and questions. Unless otherwise noted, your Submission should either be a technical support question or a technical support answer. Constructive feedback about product features is welcome as well. If your Submission contains the phrase "I'm sorry for the rant, but…" you are likely in violation of this policy.

Sep 12, 2017 1:32 AM in response to saxman1.586

Hi saxman,

Take a look at this old discussion (from November 2014) in Numbers for Mac

https://discussions.apple.com/thread/6696436

Click on Wayne Contello's link for Numbers 3.x

https://www.dropbox.com/sh/wz5ejppkbd924mu/AADXJLJ3brHqJL9ts4iq_Kn1a?dl=0

and download ValueToText (v3px).numbers.

Give it a try. Good luck!


Disclaimer: that is an old discussion and I have not fully tested that downloaded document.


Regards,

Ian.

Sep 10, 2017 3:11 PM in response to saxman1.586

Here is a classic example of just how much Inconvenience are you going to go through for the sake of chasing "Convenience", or how much time are you going to waste to "Save time".


I am now going to time how long it takes for me to type "one hundred and fifty dollars and 10 cents".


About 11 seconds and I am a lousy typist and am having to fight the Mac's Spill Chucker.


Bet it will take longer to kick in and run the AppleScript.


Peter

Sep 11, 2017 4:34 PM in response to VikingOSX

That is always the toss up. How much time do you throw at the possibility (not certainty) of accomplishing minor tasks slightly quicker, especially when "solutions' take time to set-up, debug and update when software changes.


I work in a Public Service town and get to see whole departments diverted from doing their real work to the distraction of "improvements".


Not saying this is one of those, but you frequently don't know when you enter the swamp if there is an end to it.


Peter

Sep 16, 2017 9:21 PM in response to saxman1.586

You seem to be misreading my posts. There is no sarcasm unless it is in your own head.


I actually do help people, as you can see by looking at my points and comparing them with your own.


I fully understand that some people simply do not like to hear alternatives, or in fact anything else they don't want to hear.


That is usually why they are experiencing problems.


My suggestions often come from the angle you have not thought of. Since you have not thought of a solution, despite they exist and can be found if you look, that is not unexpected.


There are many ways to skin a cat. Sometimes it is better to leave the poor beast alone.


...and Apple knows when to discipline me if it is necessary, which it certainly wasn't in this case, and it definitely wasn't necessary for you to round up your own posse.


Peter

convert number to text

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.