How to Calc Selling Cost When % Cost Added To Sell Price?

I have a costing problem, that seams simple but I must be missing something.

We buy a product for X and we want to make a certain margin on this product, say %M. We have postage costs say P and finally we have a transaction fee that is charged at the total sell price. So this fee is making it difficult for me to calculate what I need my sale price to be as when I increase the sale price so does the transaction fee.

What I would really like is a formula, so I can put this in our costing sheet on excel.

It's just a matter of adding in the all of those additional costs. The orginal cost to you is M and you want to make a profit of r% of M (I wouldn't say "margin" as that usually includes things like postage and "transaction fees"). That means your price would have to be M+ .01rM= M(1+ .01r). Now add postage and transaction fees to that. If the profit is to be, say, 10% of the price, postage is $0.50, and transaction fees are $2.00, then you should charge (1.1)M+ 2.50.

Thank you for your reply, but thats not what im after. Sorry I probabily did not explain it very well.

M= margin %
P= Paypal Transaction Fee
S = Sell Price
R = Postage

What I would like to do is calculate in my price the sell price to include the margin and all costs.

If for instance I want to make 10% on a product that costs £10 and £2 to post. It would be this

(10+2)x(1+0.1) = £13.20 now if we sell at £13.20 then paypal will charge 3.9% +£0.2.

£13.20 *0.039+0.2 =£0.5148. If I then add this to £13.20 to try and cover all costs I get
£13.20 + £0.5148 = £13.7178.
If I then calculate this as sold again and paypal taking their fee it is know £13.71 *0.039+£0.2=£0.7348. as this shows, the current method I have not going to work.

I have tried playing with transposing the formula to get a good model for our spreadsheets, but I am just not knoledgable enough at maths.