numbers to words

puthenveetil

Registered User.
Local time
Today, 16:43
Joined
Aug 9, 2004
Messages
94
Dear all,


If some have the code for converting amount to words in rupees, please help me...

Thanks in advance

Thanks:(
 
If i dont misunderstand (cuz my english is so so )You mean this ???
Dim MyDouble, MyString
MyDouble = 437.324 ' MyDouble is number type
MyString = CStr(MyDouble) ' MyString --> "437.324"
 
Last edited:
Still bring up a number for me
 
Is this what you are trying to do....

(This is a very cut down version from the microsoft web site)

Dave
 

Attachments

I would presume you are trying to write (imprint) a check or draft a money order in which you write out the body of the number in text.

I don't personally know of any code that does this, but it should not be too hard to do this with a little bit of thought. On the other hand, if you don't like writing VBA code, forget about it. There is no easy way to do this without VBA (that I know of).

Also, your name makes me think you are in southern Asia. The American and British system of naming your numbers differs slightly between these places, so I would wonder which standard you used. It makes a difference in what I would suggest.

In general, the way to do this is to split the digits apart by first converting the number to a text string. I.e. CSTR( amount ) is the first step even though it still displays as numeric digits. However, NOW you can extract the digits one at a time for analysis as such.

Group the digits according to your standards for naming numbers. Suppose we use the American system for the example. A number such as 1234567.89 can be subdivided as 1,234,567.89. Then extract the digits in groups of three and supply a suffix as required for each group. Separate the digits within the groups and supply the names for the numbers.

You need one of two lookups. A digit must be taken from either a table that shows its "normal" name or its "tens" usage.

For example, the part of the number that is ,234, is ... look up the 2 as "two" ; look up the 3 (in the tens place) as "thirty" ; look up the 4 as "four" and then concatenate to get...

two hundred thirty four. Add the suffix for the group position (which was "thousand" in my example.) For the special case of the teens (tens digit is one), you have a third lookup.

So you would have one million, two hundred thirty four thousand, five hundred sixty seven and eighty-nine hundredths. Unless you wrote the last part as 89/100. Divide it into groups, then recognize that the translation pattern works the same within groups and all you really need is a group suffix. Finally, define the group names you need: thousand, million, billion, trillion, quatrillion (quadrillion in some authorities...), etc.

I won't write it for you but I think I just designed it for you conceptually. Have fun!
 
Last edited:

Users who are viewing this thread

Back
Top Bottom