Forum Discussion
AmedhaSurve1
3 years agoQrew Member
You are my Favorite Human
------------------------------
Amedha Surve
------------------------------
------------------------------
Amedha Surve
------------------------------
- PrashantMaheshw3 years agoQrew CaptainI've created something which seems to work fine for us
- It ain't pretty , and can be optimised big time towards the end
- Doesn't work for more than 99 crore (yet)
var number numt = [Number]; // Define your field
var number crore=ToNumber(Right(ToText(If($numt>9999999,Floor($numt/10000000))),2)); // Extract Crore if they exists
var number lakhs=ToNumber(Right(ToText(If($numt>99999,Floor($numt/100000))),2));
var number thousands = ToNumber(Right(ToText(If($numt>999,Floor($numt/1000))),2));
var text hundreds = If($numt>99,Left(Right(ToText(Floor($numt)),3),1));
var text tens = If($numt>1,ToText(ToNumber(Right(ToText(Floor($numt)),2))));
var text fraction = If(not IsNull(Frac($numt)),ToText(Frac($numt)*100));
// ----- Crore Begins ---- \\
If($crore>10 and $crore<20, Case($crore, 11,"Eleven", 12,"Twleve",13,"Thirteen",14,"Fourteen",15,"Fifteen",16,"Sixteen",17,"Seventeen",18,"Eighteen",19,"Ninteen"),
Case(Floor($crore/10), 1, "Ten", 2, "Twenty ", 3, "Thirty ", 4, "Forty ", 5, "Fifty ", 6, "Sixty ", 7, "Seventy ", 8, "Eighty", 9, "Ninety ", 0, "")
& Case(Mod($crore,10), 1, "One", 2, "Two", 3, "Three", 4, "Four", 5, "Five", 6, "Six", 7, "Seven", 8, "Eight", 9, "Nine", 0, ""))
& If(ToText($crore)="","",$crore=0,""," Crores ") &
// ----- Lahs Begins ---- \\
If($lakhs>10 and $lakhs<20, Case($lakhs, 11,"Eleven", 12,"Twleve",13,"Thirteen",14,"Forteen",15,"Fifteen",16,"Sixteen",17,"Seventeen",18,"Eighteen",19,"Ninteen"),
Case(Floor($lakhs/10), 1, "Ten", 2, "Twenty ", 3, "Thirty ", 4, "Forty ", 5, "Fifty ", 6, "Sixty ", 7, "Seventy ", 8, "Eighty", 9, "Ninety ", 0, "")
& Case(Mod($lakhs,10), 1, "One", 2, "Two", 3, "Three", 4, "Four", 5, "Five", 6, "Six", 7, "Seven", 8, "Eight", 9, "Nine", 0, ""))
& If(ToText($lakhs)="","",$lakhs=0,""," Lakhs ")&
// ----- Thousand Begins ---- \\
If($thousands>10 and $thousands<20, Case($thousands, 11,"Eleven", 12,"Twleve",13,"Thirteen",14,"Forteen",15,"Fifteen",16,"Sixteen",17,"Seventeen",18,"Eighteen",19,"Ninteen"),
Case(Floor($thousands/10), 1, "Ten", 2, "Twenty ", 3, "Thirty ", 4, "Forty ", 5, "Fifty ", 6, "Sixty ", 7, "Seventy ", 8, "Eighty", 9, "Ninety ", 0, "")
& Case(Mod($thousands,10), 1, "One", 2, "Two", 3, "Three", 4, "Four", 5, "Five", 6, "Six", 7, "Seven", 8, "Eight", 9, "Nine", 0, ""))
& If(ToText($thousands)="",""," Thousand ") &
Case($hundreds,"1", "One Hundred ", "2", "Two Hundred ", "3", "Three Hundred ", "4", "Four Hundred ", "5", "Five Hundred ", "6", "Six Hundred ", "7", "Seven Hundred ", "8", "Eight Hundred ", "9", "Nine Hundred ", "0", "") &
/// - X TENS //
// ---X tens Sequence Being X ---- /
If(
$tens= "1", "One",
$tens= "2", "Two",
$tens= "3", "Three",
$tens= "4", "Four",
$tens= "5", "Five",
$tens= "6", "Six",
$tens= "7", "Seven",
$tens= "8", "Eight",
$tens= "9", "Nine",
$tens= "11","Eleven",
$tens= "12","Twleve",
$tens= "13","Thirteen",
$tens= "14","Fourteen",
$tens= "15","Fifteen",
$tens= "16","Sixteen",
$tens= "17","Seventeen",
$tens= "18","Eighteen",
$tens= "19","Ninteen",
$tens= "10", "Ten",
$tens= "20", "Twenty",
$tens= "30", "Thirty",
$tens= "40", "Forty",
$tens= "50", "Fifty",
$tens= "60", "Sixty",
$tens= "70", "Seventy",
$tens= "80", "Eighty",
$tens= "90", "Ninety",
Case(Floor(ToNumber($tens)/10), 2, "Twenty ", 3, "Thirty ", 4, "Forty ", 5, "Fifty ", 6, "Sixty ", 7, "Seventy ", 8, "Eighty ", 9, "Ninety ") &
Case(Right(ToText($tens),1), "1", "One", "2", "Two", "3", "Three" , "4", "Four", "5", "Five", "6", "Six", "7", "Seven", "8", "Eight", "9", "Nine", "0", ""))&
// ---X Fraction Sequence Being X ---- /
If(
$fraction= "1", " & One Paisa Only",
$fraction= "2", " & Two Paisa Only",
$fraction= "3", " & Three Paisa Only",
$fraction= "4", " & Four Paisa Only",
$fraction= "5", " & Five Paisa Only",
$fraction= "6", " & Six Paisa Only",
$fraction= "7", " & Seven Paisa Only",
$fraction= "8", " & Eight Paisa Only",
$fraction= "9", " & Nine Paisa Only",
$fraction= "11"," & Eleven Paisa Only",
$fraction= "12"," & Twleve Paisa Only",
$fraction= "13"," & Thirteen Paisa Only",
$fraction= "14"," & Fourteen Paisa Only",
$fraction= "15"," & Fifteen Paisa Only",
$fraction= "16"," & Sixteen Paisa Only",
$fraction= "17"," & Seventeen Paisa Only",
$fraction= "18"," & Eighteen Paisa Only",
$fraction= "19"," & Ninteen Paisa Only",
$fraction= "10", " & Ten Paisa Only",
$fraction= "20", " & Twenty Paisa Only",
$fraction= "30", " & Thirty Paisa Only",
$fraction= "40", " & Forty Paisa Only",
$fraction= "50", " & Fifty Paisa Only",
$fraction= "60", " & Sixty Paisa Only",
$fraction= "70", " & Seventy Paisa Only",
$fraction= "80", " & Eighty Paisa Only",
$fraction= "90", " & Ninety Paisa Only",
Case(Floor(ToNumber($fraction)/10), 2, " & Twenty ", 3, " & Thirty ", 4, " & Forty ", 5, " & Fifty ", 6, " & Sixty ", 7, " & Seventy ", 8, " & Eighty ", 9, " & Ninety ") &
Case(Right(ToText($fraction),1), "1", "One Paisa Only", "2", "Two Paisa Only", "3", "Three Paisa Only" , "4", "Four Paisa Only", "5", "Five Paisa Only", "6", "Six Paisa Only", "7", "Seven Paisa Only", "8", "Eight Paisa Only", "9", "Nine Paisa Only", "0", ""))
------------------------------
Prashant Maheshwari
------------------------------