Hi....
Thanks a lot....
Its working for me.....
Another option being without helper column (Cost of Goods Sold)
1] In "Purchase" C2, enter : 0
and, C2 >> Format cell >> Custom >> in the Type box enter :
;;"NAV"
2] In "Closing Stock, Unit" H3, formula copy down :
=N(H2)+B3-E3
3] In "Closing Stock, Total" I3, formula copy down :
=SUMPRODUCT((((SUMIF(OFFSET(B$3,,,ROW(B$1:B1)),">0")-SUM(E$3:E3))*(SUM(E$3:E3)<SUMIF(OFFSET(B$3,,,ROW(B$1:B1)),">0")))-(SUM(E$3:E3)<SUMIF(OFFSET(B$2,,,ROW(B$1:B1)),">0"))*(SUMIF(OFFSET(B$2,,,ROW(B$1:B1)),">0")-SUM(E$3:E3))),C$3:C3)
4] In "Profit" J3, formula copy down :
=G3+SUM(G$2:G2)-SUMPRODUCT((SUM(E$3:E3)>SUMIF(OFFSET(B$2,,,ROW(B$1:B1)),">0"))*(SUM(E$3:E3)-SUMIF(OFFSET(B$2,,,ROW(B$1:B1)),">0"))*(C$3:C3-C$2:C2))-SUM(J$2:J2)
Regards
Bosco