79827198

Date: 2025-11-22 08:18:20
Score: 0.5
Natty:
Report link

@Harun24hr I've edited my original response as requested (see above). Also, I reviewed your formula again and modified portions of it as follows:

=LAMBDA(number,
    LET(
        num, ABS(number),
        int, INT(num),
        dec, ROUND(num - int, 2) * 100,
        txt, TEXT(int, "000000000000000"),
        one, {"One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"},
        ten, {"Ten","Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety","Hundred"},
        cc, CHOOSECOLS,
        fn, LAMBDA(me,val,abr,[tri],
            IF(
                tri,
                IF(val > 99, me(me, --LEFT(val, 1), "Hundred ") & LAMBDA(vl, IF(vl,  me(me, vl, abr), abr))(--RIGHT(val, 2)), me(me, val, abr)),
                IFERROR(IF(val < 20, cc(one, val), cc(ten, LEFT(val, 1)) & "-" & IFERROR(cc(one, RIGHT(val, 1)), "")) & " " & abr & " ", "")
            )
        ),
        SPELL, LAMBDA(v,a,[t], fn(fn,v,a,t)),
        doll, CONCAT(MAP(--MID(txt, {1,4,7,10,13,14}, {3,3,3,3,1,2}), {"Trillion","Billion","Million","Thousand","Hundred",""}, {1,1,1,1,0,0}, SPELL)),
        cent, SPELL(dec, "Cent Only."),
        TRIM(IF(AND(doll <> "", cent <> ""), doll & " Dollar And " & cent, IF(doll = "", cent, doll & " Dollar Only.")))
    )
)

The most notable change I made was to merge SPELL and SPELL3 into a single recursive function with an optional [tri] argument to toggle between the two routines. I also updated the doll variable accordingly and renamed a few other variables. Other than that, I tried to stay as true as possible to your original function. Hopefully it works as expected.

Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @Harun24hr
  • Looks like a comment (1):
Posted by: DjC