C#

Asked • 06/07/19

Calculate Gross Profit W/O Sell?

Trying to make myself a small project for work that will calculate gross profit without needing a sell price. Can anyone explain why this is getting marked down? we all needed help at one point.. I currently have 4 text boxes, Cost, Sell, Gross Profit Margin, Markup How i normally do it it excel is `=Cost/(1-Gp Markup)` and this would return $14.99 sell @ $12.74 cost for example @ 15% My code is below any help would be appreciated :) private void button2_Click(object sender, EventArgs e) { double cost = Convert.ToDouble(costTextBox.Text); double grossmargin = Convert.ToDouble(grossmarginTextBox.Text); double grossSellFinal = cost + (cost * grossmargin)/100; // This returns $14.65 which is a mark up not gross profit sellTextBox.Text = grossSellFinal.ToString(); } I have also tried this private void button2_Click(object sender, EventArgs e) { double cost = Convert.ToDouble(costTextBox.Text); double grossmargin = Convert.ToDouble(grossmarginTextBox.Text); double grossSellFinal = cost / (1 - grossmargin); //This returns a sell of -0.91 sellTextBox.Text = grossSellFinal.ToString(); } https://www.calculatorsoup.com/calculators/financial/margin-calculator.php?cost=12.74&revenue=14.99&action=solve

1 Expert Answer

By:

L A. answered • 07/16/24

Tutor
New to Wyzant

Full stack Developer

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.