Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PROFIT PERCENT CALCULATION

Status
Not open for further replies.

emb51

Technical User
Dec 29, 2008
5
US
I'M TRYING TO CREATE A FURMULA TO CALCULATE THE PROFIT% OF EACH ITEM BY ITS STYLE LIKE THIS

{@T.$i/sSTYLE}/Sum ({@Tcost}, {INV.STYLE})*100

BUT I GOT THE "DIVISION BY ZERO" ERROR, I SEARCHED FOR A SOLUTION AND FIND INFO TO TRY LIKE THIS

if{@T.$i/sSTYLE}<>0 then{@T.$i/sSTYLE}/Sum ({@Tcost}, {LANDINV.STYLE})*100
else 0

BUT I'M STILL GETTING THIS ERROR

CAN ANYBODY HELP ME PLEASE ?
 
Please don't use caps.

You need to test for the zero value of the denominator, not the numerator:

if Sum ({@Tcost}, {LANDINV.STYLE}) <> 0 then
{@T.$i/sSTYLE} % Sum ({@Tcost}, {LANDINV.STYLE})

This assumes that the content of the nested formulas don't have the divide by zero error.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top