John Baird
Coatesville, Pennsylvanie, États-Unis
Information générale
Catégorie:
Codage, syntaxe et commandes
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
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement