A dynamic LiFo stack? You were doing that already with your grid, I suppose (at each sell, shift previous values and insert new price). You could do it all in one cell/column by converting prices to text and concatenating them with a separator character. (like $!) With each sell: convert price to text, append '$', put before existing stack/string-with-prices. With each buy, extract first price text, convert to numeric, and shorten stack. Check for maximum string length in Excel (is there one?)
Regards,
Karel