jac.kock Posted February 11, 2013 Share Posted February 11, 2013 hi all, i want to know how to calculate the percentage for each total but i looked around and i cant seem to find it. lets say i have a bar which is 100% and i want to show in the bar someting like this: value 1 = 19 value 2 = 33 value 3 = 12 value 4 = 5 value 5 = 129 i want for each of the value's a percentage which add's up to 100 % like: value 1 = 6% value 2 = 18% value 3 = 4% value 4 = 1% value 5 = 71% can someone help me to calculate this ??? thnx in advance, Link to comment https://forums.phpfreaks.com/topic/274318-calculate-percentage-for-more-then-3-varibles-need-some-help/ Share on other sites More sharing options...
Jessica Posted February 11, 2013 Share Posted February 11, 2013 Add them all up, then divide each one by the total and *100 to get the percentage. Link to comment https://forums.phpfreaks.com/topic/274318-calculate-percentage-for-more-then-3-varibles-need-some-help/#findComment-1411633 Share on other sites More sharing options...
jac.kock Posted February 11, 2013 Author Share Posted February 11, 2013 Add them all up, then divide each one by the total and *100 to get the percentage. thanx but can you give it like a code because i cant to seem to get it right it will help me to understand where i go wrong thnx jessica, Link to comment https://forums.phpfreaks.com/topic/274318-calculate-percentage-for-more-then-3-varibles-need-some-help/#findComment-1411634 Share on other sites More sharing options...
Jessica Posted February 11, 2013 Share Posted February 11, 2013 Uhm, no. Try it. It's basic math. Link to comment https://forums.phpfreaks.com/topic/274318-calculate-percentage-for-more-then-3-varibles-need-some-help/#findComment-1411637 Share on other sites More sharing options...
jac.kock Posted February 11, 2013 Author Share Posted February 11, 2013 thnx jessica! Link to comment https://forums.phpfreaks.com/topic/274318-calculate-percentage-for-more-then-3-varibles-need-some-help/#findComment-1411644 Share on other sites More sharing options...
Zane Posted February 11, 2013 Share Posted February 11, 2013 value 1 = 19 value 2 = 33 value 3 = 12 value 4 = 5 value 5 = 129 ----------------------------- total = 198 value 1 = (19 / total) * 100 = 9.6% value 2 = (33 / total) * 100 = X% value 3 = (12 / total * 100 = value 4 = ......... value 5 = .......................... Link to comment https://forums.phpfreaks.com/topic/274318-calculate-percentage-for-more-then-3-varibles-need-some-help/#findComment-1411645 Share on other sites More sharing options...
Jessica Posted February 11, 2013 Share Posted February 11, 2013 This is a coding forum. If you want help with code you need to write some. Link to comment https://forums.phpfreaks.com/topic/274318-calculate-percentage-for-more-then-3-varibles-need-some-help/#findComment-1411646 Share on other sites More sharing options...
Jessica Posted February 11, 2013 Share Posted February 11, 2013 Zane that was not directed at you (I'm on my phone sorry) Link to comment https://forums.phpfreaks.com/topic/274318-calculate-percentage-for-more-then-3-varibles-need-some-help/#findComment-1411647 Share on other sites More sharing options...
Zane Posted February 11, 2013 Share Posted February 11, 2013 Well that's a relief. Link to comment https://forums.phpfreaks.com/topic/274318-calculate-percentage-for-more-then-3-varibles-need-some-help/#findComment-1411649 Share on other sites More sharing options...
Jessica Posted February 11, 2013 Share Posted February 11, 2013 Hey I just wanted to clarify Link to comment https://forums.phpfreaks.com/topic/274318-calculate-percentage-for-more-then-3-varibles-need-some-help/#findComment-1411650 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.