Jump to content

AmountText ( amount )


 Share

This topic is 5215 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Name & Parameters: [color:red][big] AmountText ( amount ) [/big]

Description: Not quite mine, just adapted from a formula posted on the FMP website. Returns the check-style text line given a dollar amount in a number field referenced by the "amount" parameter. As posted, only works with US Currency, but I'm sure it can be modified for anything.

Sample Input:

123.45

Results:

One Hundred Twenty Three Dollars and Forty Five cents

Recursive: no

Formula:

Choose(Int(Mod(amount;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(amount;10^11) / 10^10) = 1;

Choose(Int(Mod(amount;10^10) / 10^9); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen ");

Choose(Int(Mod(amount;10^11) / 10^10); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") & 

Choose(Int(Mod(amount;10^10) / 10^9); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) &

Case(Int(Mod(amount;10^12)/10^9) and Int(Mod(amount;10^9) / 10^3); "Billion, "; Int(Mod(amount;10^12)/10^9);"Billion ";"")

& 

Choose(Int(Mod(amount;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(amount;10^8) / 10^7) = 1;

Choose(Int(Mod(amount;10^7) / 10^6); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen ");

Choose(Int(Mod(amount;10^8) / 10^7); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") & 

Choose(Int(Mod(amount;10^7) / 10^6); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & 

Case(Int(Mod(amount;10^9)/10^6) and Int(Mod(amount;10^6) / 10^3); "Million, "; Int(Mod(amount;10^9)/10^6);"Million ";"")

& 

Choose(Int(Mod(amount;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(amount;10^5) / 10^4) = 1;

Choose(Int(Mod(amount;10^4) / 10^3); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen ");

Choose(Int(Mod(amount;10^5) / 10^4); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") & 

Choose(Int(Mod(amount;10^4) / 10^3); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & 

Case(Int(Mod(amount;10^6)/10^3) and Int(Mod(amount;10^3) / 10^0); "Thousand, "; Int(Mod(amount;10^6)/10^3);"Thousand ";"")

& 

Choose(Int(Mod(amount;10^3) / 100); ""; "One Hundred "; "Two Hundred "; "Three Hundred "; "Four Hundred "; "Five Hundred "; "Six Hundred "; "Seven Hundred "; "Eight Hundred "; "Nine Hundred ") & 

If(Int(Mod(amount;100) / 10) = 1;

Choose(Int(Mod(amount;10)); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen ");

Choose(Int(Mod(amount;100) / 10); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") & 

Choose(Int(Mod(amount;10)); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & Case(Int(amount) > 1; "Dollars"; Int(amount) = 1; "Dollar"; "")

& 

If(Mod(amount; 1) and Int(amount);" and ";"") & 

If(Mod(Int(amount*10); 10) = 1;

Choose(Mod(Int(amount*100); 10); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen ");

Choose(Mod(Int(amount*10); 10); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") & 

Choose(Mod(Int(amount*100); 10); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & 

Case(Mod(amount; 1) > .01; "cents"; Mod(amount; 1) = .01; "cent";"") 

Required Functions:

Author(s):P mx4px

Date: 06/09/06

Credits: www.filemaker.com & Andy Frazier

Disclaimer:

FM Forums does not endorse or warrantee these files are fit for any particular purpose. Do not post or distribute files without written approval from the copyright owner. All files are deemed public domain unless otherwise indictated. Please backup every file that you intend to modify.

AmountTextSample.zip

Link to comment
Share on other sites

  • 5 months later...
  • 8 months later...

Genx, the cf you referenced from Brian's site accomplishes something different...that one will take 123.45 and give you "US$123.45." Mine will take 123.45 and give you "one hundred twenty three dollars and forty-five cents".

The point of mine is to give you the amount in WORDS, like you'd see in the text area of a check.

Link to comment
Share on other sites

Naturally, Mr. Smith - there is nothing new under the sun!! Also, as I mentioned, the "technique" wasn't mine...it was FMI's; I just modified it slightly to make it available as a CF in case someone needed it that way.

The function you referenced (http://www.briandunning.com/cf/22) is indeed something I hadn't seen - but then again it was posted a month after I posted this. Plus it requires two other functions - this one's self-contained. Like all things free, though - use it if you like, don't if you don't!!

'Nuff said.

Link to comment
Share on other sites

The function you referenced (http://www.briandunning.com/cf/22) is indeed something I hadn't seen - but then again it was posted a month after I posted this.

Well thats pretty strange considering that I posted the link to that CF on Wed Nov 09 2005 01:24 PM . Hehe... :

Link to comment
Share on other sites

Nah not stealing any thunder... I was just teasing you. It always helps to have different methods to solve the same problem. :

Link to comment
Share on other sites

This topic is 5215 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.