John Baird
Coatesville, Pennsylvania, United States
General information
Category:
Coding, syntax & commands
John
Try
If tnPrice-tnCost<0 then
-1*(InMargin=ROUND((1-(tnPrice/tnCost))*100,1))
else
InMargin=ROUND((1-(tnCost/tnPrice))*100,1)
endif
This may not be the correct Foxpro syntax, but hopefully the principles will be there.
Assuming 2.00 cost and 8.00 price, the formula calculates the margin at 75%
Assuming 8.00 cost and 2.00 price, the formula calculates the margin at -75%
I hope that this is what you want, although in terms of economics I cannot comment on whether or not it is correct for the formula to report -75% and not -300%.
Sha
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only