Battle_Ring
11-26-2008, 06:41 PM
Ok im trying to calculate % weight loss
Right now i have
$post['percentlost'] = ceil(intval($post['weightlost']) / intval($post['leftlose']+$post['weightlost']) * 100);
BUT this is not calculating what i need it is calculating % lost of my goal
i need it to calculate my total % of weight loss
HEre are the stats
Starting Weight: 268 lbs This is field 10
Current Weight: 265 lbs This is field 11
Goal Weight: 235 lbs This is field12
Weight Lost: 3 lbs This is weightlost
Left to Lose: 30 lbs This is leftlose
Percent Lost: 10 % this is percentlost
I believe this is the formula used to calculate % lost
Original Weight minus Current Weight
Now divide your answer by your Original Weight then multiply by 100
--------------- Added 1227733026 at 1227733026 ---------------
wouldnt it be
$post['percentlost'] = ceil(intval($post['field10']) - intval($post['field11']) / intval($post['field10']) * 100);
??? but for some reason that gives me 170 %
Right now i have
$post['percentlost'] = ceil(intval($post['weightlost']) / intval($post['leftlose']+$post['weightlost']) * 100);
BUT this is not calculating what i need it is calculating % lost of my goal
i need it to calculate my total % of weight loss
HEre are the stats
Starting Weight: 268 lbs This is field 10
Current Weight: 265 lbs This is field 11
Goal Weight: 235 lbs This is field12
Weight Lost: 3 lbs This is weightlost
Left to Lose: 30 lbs This is leftlose
Percent Lost: 10 % this is percentlost
I believe this is the formula used to calculate % lost
Original Weight minus Current Weight
Now divide your answer by your Original Weight then multiply by 100
--------------- Added 1227733026 at 1227733026 ---------------
wouldnt it be
$post['percentlost'] = ceil(intval($post['field10']) - intval($post['field11']) / intval($post['field10']) * 100);
??? but for some reason that gives me 170 %