Help

Re: 22.22 to ****Twenty Two Dollars & 22/100****

534 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Ray_Land
5 - Automation Enthusiast
5 - Automation Enthusiast

good day!

I am looking for a best practice in Airtable for preferrable a Calculation that will write out the long form of an amount, such as is written on a check up to $1,000,000,000.00. I may also be looking to hire a developer to write such a statement. I had done it previously in Filemaker but I’m overloaded with conversion to Airtable and not sure how to handle effectively.

Thank you in advance,
Ray

2 Replies 2

I don’t think this is possible in a formula but It might be fun to try.

I typically use script to do this and I’m pretty sure this would work in a script block.

var a = ['','one ','two ','three ','four ', 'five ','six ','seven ','eight ','nine ','ten ','eleven ','twelve ','thirteen ','fourteen ','fifteen ','sixteen ','seventeen ','eighteen ','nineteen '];
var b = ['', '', 'twenty','thirty','forty','fifty', 'sixty','seventy','eighty','ninety'];

function inWords (num) {
    if ((num = num.toString()).length > 9) return 'overflow';
    n = ('000000000' + num).substr(-9).match(/^(\d{2})(\d{2})(\d{2})(\d{1})(\d{2})$/);
    if (!n) return; var str = '';
    str += (n[1] != 0) ? (a[Number(n[1])] || b[n[1][0]] + ' ' + a[n[1][1]]) + 'crore ' : '';
    str += (n[2] != 0) ? (a[Number(n[2])] || b[n[2][0]] + ' ' + a[n[2][1]]) + 'lakh ' : '';
    str += (n[3] != 0) ? (a[Number(n[3])] || b[n[3][0]] + ' ' + a[n[3][1]]) + 'thousand ' : '';
    str += (n[4] != 0) ? (a[Number(n[4])] || b[n[4][0]] + ' ' + a[n[4][1]]) + 'hundred ' : '';
    str += (n[5] != 0) ? ((str != '') ? 'and ' : '') + (a[Number(n[5])] || b[n[5][0]] + ' ' + a[n[5][1]]) + 'only ' : '';
    return str;
}
Ray_Land
5 - Automation Enthusiast
5 - Automation Enthusiast

Thank you so much Bill, I’m afraid scripting is still a little over my head right now. I’m a self taught business person always doing software work out of necessity, haha. I came from Filemaker, of course now I am just using both. I can Script and write Calculations in Filemaker, although I’m not the best. The Formulas here are very similar thankfully. I have handled the check printing a different way. I was curious, is it raw JavaScript I would need to learn to write the Scripts?

thanks so much!!!

R