SPELLNM: Spelling Out a Dollar Amount

How to:

The SPELLNM function spells out an alphanumeric string or numeric value containing two decimal places as dollars and cents. For example, the value 32.50 is spelled out as THIRTY TWO DOLLARS AND FIFTY CENTS.


Top of page

x
Syntax: How to Spell Out a Dollar Amount
SPELLNM(outlength, number, output_format)

where:

outlength

Integer

Is the number of characters in the output_format.

If you know the maximum value of the number, use the following table to determine the value of the outlength:

If the number is less than...

... outlength should be

$10

37

$100

45

$1.000

59

$10,000

74

$100,000

82

$1,000,000

96

number

Alphanumeric or any numeric format (9.2)

Is the number to be spelled out. This value must contain two decimal places.

output_format

Alphanumeric



Example: Spelling Out a Dollar Amount

SPELLNM spells out the values in CURR_SAL and stores the result in a column with the format A82:

SPELLNM(82, CURR_SAL, 'A82')

For $13,200.00, the result is THIRTEEN THOUSAND TWO HUNDRED DOLLARS AND NO CENTS.

For $18,480.00, the result is EIGHTEEN THOUSAND FOUR HUNDRED EIGHTY DOLLARS AND NO CENTS.


iWay Software