Mensaje
 
a
27/03/2000 13:28:48
John Baird
Coatesville, Pensilvania, United States
General information
Foro:
Visual FoxPro
Category:
Programación, sintáxis y comandos
Miscellaneous
ID de la conversación:
00350796
ID del mensaje:
00350928
Views:
32
>>Hi John
>>
>>I'm neither an economist nor a mathematician. Exposure to business and accounting systems may be enough. Assuming the margin is the difference between the cost and the sales as a percentage of the sales price, doesn't this work?
>>
>>abs(tnPrice-tnCost)/tnPrice*100
>>
>>HTH
>
>I've already tried that. What is happening is:
>
>Assuming 2.00 cost and 8.00 price, the formula calculates the margin at 75%.
>Assuming 2.00 price and 8.00 cost, the formula says its -300%.
>
>Shouldn't that be -75% in the second or am I not understanding the process or the math?

Negative margins are valid, aren't they? How else can you calculate whether you are going in the whole or not.

That said, how about:
round((tnPrice-tnCost)/tnCost*100,1)

Price     Cost       Result
8.00      2.00        300%   && made 300% above cost
2.00      8.00        -75%   && lost 75% of cost
HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Responder
Mapa
Ver