|
-
Jan 29th, 2000, 06:00 AM
#1
Thread Starter
Hyperactive Member
If you take to variables as integers and you divide them like so a/b = whatever it will = no biggy. But i am making something right now that it needs to tell you the percentage of something so i used this. (cor/tot) * 100
so that gives me the correct divided by the total times a hundred no problem until for example i get the total to = 19 and the cor = 3 then you get somthing like 6.33333333333333333% and thats no fun is there a way to make it round up or downso like 6.333 would be 6 or 6.9 would be 7 see what I mean. I tried using the other divide symbols (\ , mod ) but they don't give me what I want so does anyone know please help!!!
------------------
Sincerely,
Chris
:-) ;-)
just have fun out there and live life to the fullest while it is still here
Email [email protected]
-
Jan 29th, 2000, 06:35 AM
#2
Hyperactive Member
What you want = Format(Answer, "##.##")
or put in # and . in whatever form you want. I believe that will work for you.
bob
-
Jan 29th, 2000, 06:36 AM
#3
Hyperactive Member
or even better:
What you want = Format((cor/tot), "Percent")
-
Jan 29th, 2000, 07:10 AM
#4
Thread Starter
Hyperactive Member
Thanks Bob!! I liked your first reply better because when you do the 2nd it automatically goes ti the hundreths place so I used the first and took out the decimals. Thanks a lot!!!
------------------
Sincerely,
Chris
:-) ;-)
just have fun out there and live life to the fullest while it is still here
Email [email protected]
-
Jan 29th, 2000, 07:12 AM
#5
Addicted Member
Hi.
Take a look at Fix in your help file.
Good Luck.
-
Jan 29th, 2000, 08:12 AM
#6
-
Jan 29th, 2000, 08:42 AM
#7
Thread Starter
Hyperactive Member
when you multiply by a hundred first it still comes out wrong for example. (7 /15) * 100 (which was what i was using) = 46.666666666 what you gave me is (7 * 100) /15 which will = 46.666666 so that doesn't help. Thanks anyway!!
------------------
Sincerely,
Chris
:-) ;-)
just have fun out there and live life to the fullest while it is still here
Email [email protected]
-
Jan 29th, 2000, 08:47 AM
#8
Hyperactive Member
No, che!
I meant Integer division, which is accomplished using a BACK Slash ("\")
(Which is also known as Alt-92)
That way, if you first multiply by 100 and then divide, your result will be an integer.
P.D. This people at VB-world is incredible! They always find new ways to amaze us.
Now we have a hot cool flaming icon and a new "Edit w/quote" (???)
[This message has been edited by Juan Carlos Rey (edited 01-29-2000).]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|