Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert Cents to Dollar/Cents

Status
Not open for further replies.

kennedymr2

Programmer
May 23, 2001
594
AU
Sorry for such a simple question.. i must be betting old. ??

Is there a "simple" function to convert say

1323 to 13.23

Regards kennedymr2


 


hi,

simple quotient with divisor of 10[sup]2[/sup]

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 

Or - in simple term:
[tt]
1323 / 100 = 13.23[/tt] :)

Have fun.

---- Andy
 

Skip - I don't have any kids :)

And since it did not look like a school homework assignment, ...

Have fun.

---- Andy
 



3[sup]rd[/sup] grade, if i recall.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
1323 / 100 = 13.23

Gee i must be getting old or demented.. thanks
 
Just to be really pedantic

1323 / 100 = 13 [red]==> Integer arithemetic[/red]

1323. / 100 = 13.23 [red]==> Floating Point[/red]
 
Except integer division uses the backslash ...
1323\100 = 13
1323/100 = 13.23
 
Print Format(x/100,"$.##") where x is the cents to be converted
 

To expand on Ted's reply:

Format(x / 100, "$ #,##0.00")

Code:
0        becomes $ 0.00
12       becomes $ 0.12
1234     becomes $ 12.34
123456   becomes $ 1,234.56

and so on.

Heaven doesn't want me, and Hell's afraid I'll take over!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top