Please see my attachment for an example. I am trying to obtain a formula that will automatically update itself as new data is added to the list (i.e. a self updating range for a sum formula)
Column A contains purchased lbs of a product. Colum B contains the cost of the purchase. Column C contains the average cost of the purchase. As I make additional purchases, the data will be added to this list.
Let's say I currently have 400 Lbs in inventory (all other purchases identified in the list have been sold). How can a formula be written to sum a row range of the last purchases in the list so that the sum of the range equals the current inventory. That is, per the attached example, the formula would have to sum rows 8 and 9 of column A and consider the partial inventory of row 7 (e.g. 400 lbs of current inventory minus the sum of rows 8 and 9). If the current inventory was 500 lbs, the formula would have to sum rows 9, 8, 7, and the partial inventory of row 6.
Part two of the problem, is that how many ever rows are required to be summed in column A, the same is done for column B with the exception of the partial row. To consider the effect of the partial row, the formula would take the current inventory (in lbs) less the sum of the full rows (e.g. rows 8 and 9 if the current inventory is 400 - for example purposes), multiply it by the average cost of the partial row, and add it to the sum of rows 8 and 9.
These two formulas in columns A and B would allow me to obtain the average cost of my current inventory.
Can this be done with the use of the offset formula?
Thanks.
Bookmarks