RE: September Sale Lloyds was £6 now 44p2 Sep 2021 15:01
What you appear to want to do is to roll the profits or losses from a sale into the total cost. That is, if you made a profit, use that to lower the “total cost” of the shares so that you can compare that average of that “total cost” to the market price, and quickly tell if you are profitable.
Although that might be convenient, it probably would not be acceptable under most accounting conventions (so no textbook will tell you to do it that way). It also would give some strange-looking results. If you made $1 million profit on some shares, and then sold all but one of those shares, you would have a “cost” of about -$1 million for that one share. Most people would look at you funny if you showed them that number on a spreadsheet.