Spreadsheet: 454235d1459738006-ifs-and-sums-and-nests-or-something-more-simple-example-2-2016-fifo-v1
Sheet: Purchases

Bought |  |  | Sold | Closing Stock |  |  |  | Bought |  |  | Sold | Closing Stock |  |  |  | Bought |  |  | Sold | Closing Stock |  |  |  |  | Product 1 calculations
 | Quantity | Price | Quantity | Quantity | Value |  |  |  | Quantity | Price | Quantity | Quantity | Value |  |  |  | Quantity | Price | Quantity | Quantity | Value
Open Stock | 562 | 3.87 |  |  |  | 0 |  | Open Stock | 112 | 3.77 |  |  |  | 0 |  | Open Stock | 20 | 1.02 |  |  |  | 0 |  |  | First transaction
Price 1 |  |  |  |  |  |  |  | Price 1 |  |  |  |  |  |  |  | Price 1
Price 2 |  |  |  |  |  |  |  | Price 2 |  |  |  |  |  |  |  | Price 2
Price 3 |  |  |  |  |  |  |  | Price 3 |  |  |  |  |  |  |  | Price 3 |  |  |  |  |  |  |  |  | Second transaction
Price 4 |  |  |  |  |  |  |  | Price 4 |  |  |  |  |  |  |  | Price 4
Price 5 |  |  |  |  |  |  |  | Price 5 |  |  |  |  |  |  |  | Price 5
Price 6 |  |  |  |  |  |  |  | Price 6 |  |  |  |  |  |  |  | Price 6
Price 7 |  |  |  |  |  |  |  | Price 7 |  |  |  |  |  |  |  | Price 7
Price 8 |  |  |  |  |  |  |  | Price 8 |  |  |  |  |  |  |  | Price 8
Price 9 |  |  |  |  |  |  |  | Price 9 |  |  |  |  |  |  |  | Price 9
Price 10 |  |  |  |  |  |  |  | Price 10 |  |  |  |  |  |  |  | Price 10
Price 11 |  |  |  |  |  |  |  | Price 11 |  |  |  |  |  |  |  | Price 11
Price 12 |  |  |  |  |  |  |  | Price 12 |  |  |  |  |  |  |  | Price 12
Price 13 |  |  |  |  |  |  |  | Price 13 |  |  |  |  |  |  |  | Price 13
Price 14 |  |  |  |  |  |  |  | Price 14 |  |  |  |  |  |  |  | Price 14
Price 15 |  |  |  |  |  |  |  | Price 15 |  |  |  |  |  |  |  | Price 15
Price 16 |  |  |  |  |  |  |  | Price 16 |  |  |  |  |  |  |  | Price 16
Price 17 |  |  |  |  |  |  |  | Price 17 |  |  |  |  |  |  |  | Price 17
Totals |  |  |  |  |  |  |  | Totals |  |  |  |  |  |  |  | Totals
Column1 | Purchase Date | P/L No. | Running Total of Purchases | Units Bought | Unit Cost ex TAX |  |  | Column1 | Purchase Date | P/L No. | Running Total of Purchases | Units Bought | Unit Cost ex TAX |  |  | Column1 | Purchase Date | P/L No. | Running Total of Purchases | Units Bought | Unit Cost ex TAX
4 | 2015-04-09 00:00:00 | 387 |  | 1078 | 3.87 |  |  | 2 | 2015-04-09 00:00:00 |  |  | 20 | 3.77 |  |  | 6 | 2015-04-09 00:00:00 |  |  | 60 | 1.04
13 | 2015-05-11 00:00:00 | 388 |  | 1029 | 3.87 |  |  | 14 | 2015-05-11 00:00:00 |  |  | 25 | 3.77 |  |  | 18 | 2015-05-11 00:00:00 |  |  | 25 | 1.12
22 | 2015-06-12 00:00:00 | 390 |  | 49 | 6.3 |  |  | 20 | 2015-06-12 00:00:00 |  |  | 10 | 3.9 |  |  | 27 | 2015-06-12 00:00:00 |  |  | 5 | 1.23
23 | 2015-06-19 00:00:00 | 392 |  | 1078 | 3.87 |  |  | 24 | 2015-06-19 00:00:00 |  |  | 100 | 3.72 |  |  | 41 | 2015-06-19 00:00:00 |  |  | 20 | 1.16
30 | 2015-07-21 00:00:00 | 543 |  | 1078 | 3.8
39 | 2015-08-27 00:00:00 | 718 |  | 1078 | 3.8
45 | 2015-09-28 00:00:00 | 802 |  | 1078 | 3.8
47 | 2015-10-21 00:00:00 | 863 |  | 1078 | 3.8
60 | 2015-11-24 00:00:00 | 949 |  | 98 | 3.63
61 | 2015-11-25 00:00:00 | 972 |  | 1029 | 3.8
65 | 2015-12-22 00:00:00 | 1093 |  | 1078 | 3.8
67 | 2016-01-13 00:00:00 | 1115 |  | 539 | 3.6
2 | 2015-04-09 00:00:00 |  | Product 2 Name | 20 | 3.77
4 | 2015-04-09 00:00:00 | 387 | Product 1 Name | 1078 | 3.87
6 | 2015-04-09 00:00:00 |  | Product 3 Name | 60 | 1.04
13 | 2015-05-11 00:00:00 | 388 | Product 1 Name | 1029 | 3.87
14 | 2015-05-11 00:00:00 |  | Product 2 Name | 25 | 3.77
18 | 2015-05-11 00:00:00 |  | Product 3 Name | 25 | 1.12
20 | 2015-06-12 00:00:00 |  | Product 2 Name | 10 | 3.9
22 | 2015-06-12 00:00:00 | 390 | Product 1 Name | 49 | 6.3
23 | 2015-06-19 00:00:00 | 392 | Product 1 Name | 1078 | 3.87
24 | 2015-06-19 00:00:00 |  | Product 2 Name | 100 | 3.72
27 | 2015-06-12 00:00:00 |  | Product 3 Name | 5 | 1.23
30 | 2015-07-21 00:00:00 | 543 | Product 1 Name | 1078 | 3.8
39 | 2015-08-27 00:00:00 | 718 | Product 1 Name | 1078 | 3.8
41 | 2015-06-19 00:00:00 |  | Product 3 Name | 20 | 1.16
45 | 2015-09-28 00:00:00 | 802 | Product 1 Name | 1078 | 3.8
47 | 2015-10-21 00:00:00 | 863 | Product 1 Name | 1078 | 3.8
60 | 2015-11-24 00:00:00 | 949 | Product 1 Name | 98 | 3.63
61 | 2015-11-25 00:00:00 | 972 | Product 1 Name | 1029 | 3.8
65 | 2015-12-22 00:00:00 | 1093 | Product 1 Name | 1078 | 3.8
67 | 2016-01-13 00:00:00 | 1115 | Product 1 Name | 539 | 3.6
71 | 2016-02-12 00:00:00 | 1222 | Product 1 Name | 1078 | 3.6
76 | 2016-03-16 00:00:00 | 1376 | Product 1 Name | 539 | 3.6
80 | 2016-03-22 00:00:00 | 1396 | Product 1 Name | 1078 | 6.3