Forum Discussion
mandyturcotte
Sep 20, 2022Copper Contributor
Using FIFO to Determine Sale Price of Fuel
In our business, we purchase fuel in bulk and it is then "sold" to our equipment at cost. I need to be able to attribute a price to each sale. I keep feeling like I've almost got it and then it ...
- Sep 20, 2022
Now the formula with a mixed price.
mandyturcotte
Sep 20, 2022Copper Contributor
It comes close, but ideally I can be more exact with the pricing. With the attached sheet, I price only 22,564 litres at $1.4023 --That's a difference of 125 litres from what I actually purchased at that price. If I'm understanding how this is working, I could be looking at up to a 850 litre (the equipment's max capacity) difference each time the price changes.
dscheikey
Sep 20, 2022Bronze Contributor
What should the price be when the price changes. A mixed price?
3/16/2022 | 12:59:00 PM | 520 | 607 | 1.4023 |
3/16/2022 | 1:07:00 PM | 608 | 275 | 1.3936 |
3/16/2022 | 3:47:00 PM | 546 | 280 | 1.3913 |
- mandyturcotteSep 20, 2022Copper ContributorI think a mixed price is probably the best/easiest way to accomplish it.
- PeterBartholomew1Sep 20, 2022Silver Contributor
This is a technically far more complicated solution using advanced features of Excel 365.
salesPrice = LET( cumPurchases, SCAN(0,purchaseQuantity, Sumλ), cumSales, SCAN(0, quantitySold, Sumλ), MAP(cumSales-quantitySold, cumSales, LAMBDA(s₀,s₁, SUM( MAP(purchasePrice, cumPurchases-purchaseQuantity, cumPurchases, LAMBDA(pr,v₀,v₁, MAX(MIN(v₁,s₁)- MAX(v₀,s₀),0)* pr ) ) ) / (s₁-s₀) ) ) );
The formula accumulates both sales and purchase volumes. Then it calculates the overlaps and the price of each tranche. The unit price is obtained by dividing by the sales quantity.
As the sales quantities are small relative to the purchase quantities, very few sales actually require an interpolated price calculation.
- mandyturcotteSep 21, 2022Copper ContributorI'm hitting a snag with this one, Excel isn't recognizing SCAN() or MAP() functions best as I can tell. And a little research isn't giving me any answers as to why. I'm running Microsoft 365 Apps for Business as a subscription product. Version 2202 (Build 14931.20724 Click-to-Run) Semi-Annual Enterprise Channel.
- dscheikeySep 20, 2022Bronze Contributor
Now the formula with a mixed price.