Sign in to follow this  
Followers 0
golfinhu

Return Money

5 posts in this topic

#1 ·  Posted (edited)

hi people, i need help in a dumb function >.<

for example:

i have the value U$ 999,00

i need to divide the value by 6, 5, 4, 3 and 2

the value has to return with a comma, not point

and also with two decimal places after the comma

I tried to use the Round, but it did not work ...

code example:

$value = Number("999,00")
$divides = 6
Dim $msg
$msg = ""

For $i = $divides To 1 Step -1
    $msg = $msg & @CRLF & $i & "x " & $value / $i & @CRLF
Next

MsgBox(0, "Values", $msg)

he would have to return:

6x 166,50

5x 199,80

4x 249,75

3x 333,00

2x 499,50

1x 999,00

if someone can help me ...

thanks =)

Edited by golfinhu

Share this post


Link to post
Share on other sites



$msg = $msg & @CRLF & $i & "x " & StringReplace(StringFormat( "%.2f", $value / $i ),".",",")& @CRLF

Share this post


Link to post
Share on other sites

$msg = $msg & @CRLF & $i & "x " & StringReplace(StringFormat( "%.2f", $value / $i ),".",",")& @CRLF

thankyou so much!

Share this post


Link to post
Share on other sites

This seems to work the same, saving a few bytes :blink:

$msg = $msg & @CRLF & $i & "x " & StringFormat("%.2f\n", $value/$i) & @CRLF

Share this post


Link to post
Share on other sites

rss =p

thanks again =D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0