Calculate Margin

How to I calculate the profit margin with a number in system clipboard and then pasting the results into a field. Please see the image for the field.

Thanks