Proportionately distribute (prorate) a value

Posted on 2011-04-25
Last Modified: 2012-05-11
I have a problem on defining the allocation number.
let say i have number 100 and it will be allocated to 3 users.
based on the situation , the formula should be 100 devided by 3. Using that formula it will result 33.33333. When i sum the calculated value it will result 99.99999, how do i prorate the number (e.g 100) so when i sum back the prorated number , it will result the original number (e.g 100).

Question by:thomaset2000
    LVL 39

    Expert Comment

    by:Pratima Pharande
    take the Round of 99.99999
    LVL 16

    Expert Comment

    by:Imran Javed Zia

    It is generic arithmetic problem and you can come over it by Math.Round.

    in C# you can use it as following
                double Value = 100;

                double v1, v2, v3;
                v1 = v2 = v3 = Value / 3;

                double total = Math.Round(v1 + v2 + v3, 2);


    Author Comment

    is there a way , to have a formula that worked without rounding the final result ( e.g the allocation should be 33.3333 , 33.3333, 33.3334 )
    LVL 16

    Accepted Solution


    You can use something like following:

    double Value = 100;

                double v1, v2, v3;
                v1 = v2 = Value / 3;
                v3 = Value - v1 -v2;

                double total = v1 + v2 + v3;


    LVL 67

    Expert Comment

    This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
    It’s quite interesting for me as I worked with Excel using for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now