Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Convert Currency to Words

Ashwani333
5 - Atom

Dear All,

 

I got a requirement from my client to convert currency in number format to a word format, for eg, if the Amount is Rs 100 then it should also be reflected as Rupees Hundred Only.

 

Can you please help!

 

Regards

Ashwani

6 REPLIES 6
danilang
19 - Altair
19 - Altair

hi @Ashwani333 

 

This would be fairly easy to implement using the Find Replace tool or Regex once you have a mapping table between symbols and text.  The tricky part would be the variations in the text, i.e. 100€ vs €100

 

Dan

Ashwani333
5 - Atom

Hi Dan,

 

Thanks for your response and pardon me if my query was not clear, so its not only about the currency symbol but also converting the number to words.

 

Eg. 200 should be converted to 'Two Hundred'

219 should be converted to 'Two Hundred Nineteen'

10,333 should be converted to 'Ten Thousand Three hundred and Thirty Three'

 

Regards,
Ashwani

danilang
19 - Altair
19 - Altair

Hi @Ashwani333 

 

I've looked through the community and haven't found any solutions for this but this is how I'd solve it.   The word expansions repeat for each group of 3 digits starting from the right i.e. 319,319 becomes Three Hundred Nineteen Thousand Three Hundred Nineteen

1. Create a mapping table to map the digits (Digits table) from 0 to 99 to the words.  You could use 2 tables here with one for the units and one for the tens, but the logic for the workflow is easier if you don't have to worry the fact that the numbers from 11-19 are special cases, 14 is Fourteen and not Tenty Four unlike 24, 34, 44, etc.

2. Create a mapping table (Groups table)for the groups of 3, Thousand, Million, Billion, etc.

3. Convert your number to a string and extract the 3 rightmost characters, 

    a. Of these take the rightmost 2 and join to the Digits table

    b. Take the left most character and join to the Digits table and add Hundred after it.

    c. Depending on which group of three your currently parsing, join to the Groups table to get the group designation

 

Make sure you get a requirement about the "and"(Ten Thousand Three hundred and Thirty Three).  2 of your three examples don't include it.  Try to get your client to agree to never use it.

 

Dan

Ashwani333
5 - Atom

Hi Dan

 

 

Thanks for suggestion! But with the bit help of the R community ("https://gist.githubusercontent.com/hack-r/22104543e2151519c41a8f0ce042b31c/raw/01731f3176b4ee4717856..."), I have created my own workflow.

 

Regards, Ashwani

Salam
5 - Atom

Hi Aswani333,

 

Pythonic way of converting Numbers to words. :))

z197522
5 - Atom

R plug in worked like a charm!

Labels