I need the formula for the highlighted columns, I tried using Pivot Table but it does not help as average is not based on quantity purchased. Also cannot find a way to total BUY and SELL separately. I do not mind changing the data structure / adding columns if needed (transactions) Please assist; - cross posted