I am writing a code where I need to convert between the profit margin % to the markup %
For example if I type 50% Profit Margin then the Markup % should be 100%. If I type 75% profit Margin then the markup % will = 300%.
I found this link that gives the formulas http://larig.wordpress.com/2010/07/06/convert-between-margin-and-mark-up/
|margin| = 1 - 1 / (1 + |markup|)
|markup| = 1 / (1 - |margin|) - 1
when I tried to apply the formula I do not get the desired results. (This formula did not make since and it is not calculating correctly.)
Here is what I have done using C#
InputMarkup.Text = Math.Abs((1 / (1 - Math.Abs(margin) - 1))).ToString();
I also tried this
InputMarkup.Text = Math.Abs((1 / (1 - Math.Abs(margin))) - 1).ToString()
I figured it out. The formula was incorrect
this is the correct formula
Converting Between Markup vs Margin
In the event that you know either the markup or the margin and need to know the other, then the following formulas will help you calculate. Markup = Margin / (1 – Margin)
So for example if the margin is 33.33% or 0.3333 them the markup is given by Markup = 0.3333 / 1 – 0.3333 = 0.3333 / 0.6667 = 0.50 or 50% and, Margin = Markup / (1 + Markup)
So for example if the markup is 50% or 0.5 then the margin is given by Margin = 0.5 / (1 + 0.5) = 0.5 / 1.5 = 0.3333 or 33.33%