Results 1 to 8 of 8

Thread: Help please on dividing

  1. #1

    Thread Starter
    Hyperactive Member PITBULLCJR's Avatar
    Join Date
    Nov 1999
    Location
    New York
    Posts
    408

    Post

    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]


  2. #2
    Hyperactive Member
    Join Date
    Sep 1999
    Posts
    305

    Post

    What you want = Format(Answer, "##.##")

    or put in # and . in whatever form you want. I believe that will work for you.

    bob

  3. #3
    Hyperactive Member
    Join Date
    Sep 1999
    Posts
    305

    Post

    or even better:

    What you want = Format((cor/tot), "Percent")

  4. #4

    Thread Starter
    Hyperactive Member PITBULLCJR's Avatar
    Join Date
    Nov 1999
    Location
    New York
    Posts
    408

    Post

    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]


  5. #5
    Addicted Member
    Join Date
    Jul 1999
    Location
    Portland, OR.
    Posts
    226

    Post

    Hi.

    Take a look at Fix in your help file.

    Good Luck.

  6. #6
    Hyperactive Member Juan Carlos Rey's Avatar
    Join Date
    Aug 1999
    Location
    Mendoza, Argentina
    Posts
    301

    Post

    Want an easier way? Multiply by 100 before dividing:

    cor * 100 \ tot

    HTH


  7. #7

    Thread Starter
    Hyperactive Member PITBULLCJR's Avatar
    Join Date
    Nov 1999
    Location
    New York
    Posts
    408

    Post

    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]


  8. #8
    Hyperactive Member Juan Carlos Rey's Avatar
    Join Date
    Aug 1999
    Location
    Mendoza, Argentina
    Posts
    301

    Post

    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
  •  



Click Here to Expand Forum to Full Width