J for spreadsheet calculations on [2014-03-18 Tue 09:06]

+PROPERTY: session j

Margin % is calculated as 1 - Extended Cost / Extended Price

Or more traditionally as Price - Cost / Price

In the example above, I have units as 100 and 5 and prices of 10,7.5 and costs of 3 and 2

Price & Cost

_2[\ (10 3 7.5 2)
 10 3
7.5 2

Extended Price & Cost:

(100 5) * _2[\ (10 3 7.5 2)
1000 300
37.5  10

Total Cost & Price

+/ (100 5) * _2[\ (10 3 7.5 2)
1037.5 310

Margin %

 1- %~/ +/ (100 5) * _2[\ (10 3 7.5 2)
0.701205



Prev: New Year / New Language - Nim  Next: J vs Javascript vs PicoLisp short comparison