Salesforce and other SMB Solutions are coming soon. ×

# transforming currency to text

## Recommended Posts

just curious

how do you transform \$1,234.56 to One thousand two hundred thirty four dollars & 56 cents"?

##### Share on other sites

First thing you do, is bookmark this link

.... or this one.

If you check them out, you'll find this

.... and if I had of checked the sub-forum I would have seen it was FileMaker 5 or 6. You can still grab the calculation contained in the custom function and adapt it for your solution, but you won't be able to create the custom function, I think those came in version 7 or 8, not sure, but definitely not in 6.

##### Share on other sites

it seems that it can't be done in FMP5

##### Share on other sites

I guarantee there is a calculation capable of doing it, but it is probably going to be insanely long winded without the use of recursion or the "Let" statement.

##### Share on other sites

Doable and not so long.

Two possible ways to go (among others), with a little tweaking:

Version 01

```Choose(Int(Int(NumberField/1000000)/100)
;"";"One";"Two";"Three";"Four";"Five";"Six";"Seven";"Eight";"Nine") & If(Int(Int(NumberField/1000000)/100) > 0;" Hundred ";"") & Choose(Int(Mod(Int(NumberField/1000000);100)/10);"";"";"Twenty ";"Thirty ";"Forty ";"Fifty"; "Sixty ";"Seventy ";"Eighty ";"Ninety ") & Choose(If(Mod(Int(NumberField/1000000);100)  >= 20;Mod(Int(NumberField/1000000);10); Mod(Int(NumberField/1000000);100));""; "One " ;"Two " ;"Three " ;"Four " ;"Five " ;"Six " ;"Seven " ;"Eight ";"Nine " ;
"Ten " ;"Eleven " ;"Twelve " ;"Thirteen " ;"Fourteen " ;"Fifteen ";"Sixteen " ;
"Seventeen " ;"Eighteen " ;"Nineteen ") & If(Int(NumberField/1000000) > 0;"Million ";"") & Choose(Int(Int((NumberField-(Int(NumberField/1000000) * 1000000 ))/1000)/100);"";"One";"Two";"Three";"Four";"Five";"Six";
"Seven";"Eight";"Nine") & If(Int(Int((NumberField-(Int(NumberField/1000000) * 1000000 ))/1000)/100) > 0;" Hundred ";"") &
Choose(Int(Mod(Int((NumberField-(Int(NumberField/1000000) * 1000000 ))/1000);100)/10);"";"";"Twenty ";"Thirty ";"Forty";"Fifty ";
"Sixty ";"Seventy ";"Eighty ";"Ninety ") & Choose(If(Mod(Int((NumberField-(Int(NumberField/1000000) * 1000000 ))/1000);100)  >= 20;Mod(Int((NumberField-(Int(NumberField/1000000) * 1000000 ))/1000);10);Mod(Int((NumberField-(Int(NumberField/1000000) * 1000000 ))/1000);100));
"";"One " ;"Two " ;"Three " ;"Four " ;"Five " ;"Six " ;"Seven " ;"Eight ";"Nine " ;
"Ten " ;"Eleven " ;"Twelve " ;"Thirteen " ;"Fourteen " ;"Fifteen ";"Sixteen " ;
"Seventeen " ;"Eighteen " ;"Nineteen ") & If(Int((NumberField-(Int(NumberField/1000000) * 1000000 ))/1000) > 0;"Thousand ";"") & Choose(Int(Int(Mod(NumberField;1000))/100);"";"One";"Two";"Three";"Four";"Five";"Six";
"Seven";"Eight";"Nine") & If(Int(Int(Mod(NumberField;1000))/100) > 0;" Hundred ";"") &
Choose(Int(Mod(Int(Mod(NumberField;1000));100)/10);"";"";"Twenty ";"Thirty ";"Forty";"Fifty ";
"Sixty ";"Seventy ";"Eighty ";"Ninety ") & Choose(If(Mod(Int(Mod(NumberField;1000));100)  >= 20;Mod(Int(Mod(NumberField;1000));10);Mod(Int(Mod(NumberField;1000));100));
"";"One " ;"Two " ;"Three " ;"Four " ;"Five " ;"Six " ;"Seven " ;"Eight ";"Nine " ;
"Ten " ;"Eleven " ;"Twelve " ;"Thirteen " ;"Fourteen " ;"Fifteen ";"Sixteen " ;
"Seventeen " ;"Eighteen " ;"Nineteen ") & If(GetAsNumber(NumberField) < 1;"No Dollars"; If(GetAsNumber(NumberField) < 2;"Dollar";"Dollars")) & " & " & Choose(Int(Mod((NumberField-Int(NumberField))*100 +.00005;100)/10);"";"";"Twenty ";"Thirty ";"Forty ";"Fifty";"Sixty ";"Seventy ";"Eighty ";"Ninety ") & Choose(If(Mod((NumberField-Int(NumberField))*100 +.00005;100)  >= 20;Mod((NumberField-Int(NumberField))*100 +.00005;10);Mod((NumberField-Int(NumberField))*100 +.00005;100));"";"One " ;"Two " ;"Three " ;"Four " ;"Five " ;"Six " ;"Seven " ;"Eight ";"Nine " ;"Ten " ;"Eleven " ;"Twelve " ;"Thirteen " ;"Fourteen " ;"Fifteen ";"Sixteen " ;"Seventeen " ;"Eighteen " ;"Nineteen ") & If((NumberField-Int(NumberField))*100 +.00005 < 1;"No Cents"; If((NumberField-Int(NumberField))*100 +.00005 < 2;"Cent";"Cents"))
```

Version 02

```Choose(Int(Mod(NumberField;10^12) / 10^11); ""; "One Hundred "; "Two
Hundred "; "Three Hundred "; "Four Hundred "; "Five Hundred "; "Six
Hundred "; "Seven Hundred "; "Eight Hundred "; "Nine Hundred ")
&
If(Int(Mod(NumberField;10^11) / 10^10) = 1;
Choose(Int(Mod(NumberField;10^10) / 10^9); "Ten "; "Eleven "; "Twelve
"; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen ";
"Eighteen "; "Nineteen ");
Choose(Int(Mod(NumberField;10^11) / 10^10); ""; ""; "Twenty ";
"Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty ";
"Ninety ")
&
Choose(Int(Mod(NumberField;10^10) / 10^9); ""; "One "; "Two "; "Three
"; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine "))
&
Case(Int(Mod(NumberField;10^12)/10^9) and Int(Mod(NumberField;10^9) /
10^3); "Billion; "; Int(Mod(NumberField;10^12)/10^9);"Billion ";"")
&
Choose(Int(Mod(NumberField;10^9) / 10^8); ""; "One Hundred "; "Two
Hundred "; "Three Hundred "; "Four Hundred "; "Five Hundred "; "Six
Hundred "; "Seven Hundred "; "Eight Hundred "; "Nine Hundred ")
&
If(Int(Mod(NumberField;10^8) / 10^7) = 1;
Choose(Int(Mod(NumberField;10^7) / 10^6); "Ten "; "Eleven "; "Twelve
"; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen ";
"Eighteen "; "Nineteen ");
Choose(Int(Mod(NumberField;10^8) / 10^7); ""; ""; "Twenty "; "Thirty
"; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ")
&
Choose(Int(Mod(NumberField;10^7) / 10^6); ""; "One "; "Two "; "Three
"; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine "))
&
Case(Int(Mod(NumberField;10^9)/10^6) and Int(Mod(NumberField;10^6) /
10^3); "Million; "; Int(Mod(NumberField;10^9)/10^6);"Million ";"")
&
Choose(Int(Mod(NumberField;10^6) / 10^5); ""; "One Hundred "; "Two
Hundred "; "Three Hundred "; "Four Hundred "; "Five Hundred "; "Six
Hundred "; "Seven Hundred "; "Eight Hundred "; "Nine Hundred ")
&
If(Int(Mod(NumberField;10^5) / 10^4) = 1;
Choose(Int(Mod(NumberField;10^4) / 10^3); "Ten "; "Eleven "; "Twelve
"; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen ";
"Eighteen "; "Nineteen ");
Choose(Int(Mod(NumberField;10^5) / 10^4); ""; ""; "Twenty "; "Thirty
"; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ")
&
Choose(Int(Mod(NumberField;10^4) / 10^3); ""; "One "; "Two "; "Three
"; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine "))
&
Case(Int(Mod(NumberField;10^6)/10^3) and Int(Mod(NumberField;10^3) /
10^0); "Thousand; "; Int(Mod(NumberField;10^6)/10^3);"Thousand ";"")
&
Choose(Int(Mod(NumberField;10^3) / 100); ""; "One Hundred "; "Two
Hundred "; "Three Hundred "; "Four Hundred "; "Five Hundred "; "Six
Hundred "; "Seven Hundred "; "Eight Hundred "; "Nine Hundred ")
&
If(Int(Mod(NumberField;100) / 10) = 1;
Choose(Int(Mod(NumberField;10)); "Ten "; "Eleven "; "Twelve ";
"Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen ";
"Eighteen "; "Nineteen ");
Choose(Int(Mod(NumberField;100) / 10); ""; ""; "Twenty "; "Thirty ";
"Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") &
Choose(Int(Mod(NumberField;10)); ""; "One "; "Two "; "Three "; "Four
"; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) &
Case(Int(NumberField) > 1; "Dollars"; Int(NumberField) = 1; "Dollar";
"")
&
If(Mod(NumberField; 1) and Int(NumberField);" and ";"")
&
If(Mod(Int(NumberField*10); 10) = 1;
Choose(Mod(Int(NumberField*100); 10); "Ten "; "Eleven "; "Twelve ";
"Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen ";
"Eighteen "; "Nineteen ");
Choose(Mod(Int(NumberField*10); 10); ""; ""; "Twenty "; "Thirty ";
"Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ")
&
Choose(Mod(Int(NumberField*100); 10); ""; "One "; "Two "; "Three ";
"Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) &
Case(Mod(NumberField; 1) > ;01; "cents"; Mod(NumberField; 1) = ;01; "cent";"")
```

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

• ### Images

• 0
By Soliant Consulting,
• 0
By Soliant Consulting,
• 0
By Soliant Consulting,
• ### Forum Statistics

• Total Topics
33.6k
• Total Posts
141.5k
×
×
• Create New...