How to Calculate Gross Profit Margin Percentage with Formula in Excel: 2 Methods

Method 1 – Excel Formula to Calculate Gross Profit Margin

STEPS:

  • Select the cell where you want to get the gross profit margin. Select cell E5.
  • Write down the formula there.
=(C5-D5)/C5

2 Methods to Calculate Gross Profit Margin Percentage with Formula in Excel

C5 is the selling price, and D5 is the cost of goods.

  • Press Enter and we will get the Gross Profit Margin.

2 Methods to Calculate Gross Profit Margin Percentage with Formula in Excel

  • Add a percentage (%), first choose the values in the Gross Profit Margin column range E5:E10, go to the Home tab from the ribbon and select the Percent option in the Number group.
  • You can also use the keyboard shortcut key ‘Ctrl + Shift + %’.

2 Methods to Calculate Gross Profit Margin Percentage with Formula in Excel

  • We can see the result in percentage.

  • Drag the Fill Handle down.

  • Get the Gross Profit Margin Percentage.

2 Methods to Calculate Gross Profit Margin Percentage with Formula in Excel


Method 2 – User-Defined Formula Using VBA Code to Find Gross Profit Margin

STEPS:

  • Go to the Developer tab from the ribbon.
  • Click on Visual Basic to open the Visual Basic Editor.
  • Another way to open the Visual Basic Editor is simply to press Alt + F11.

2 Methods to Calculate Gross Profit Margin Percentage with Formula in Excel

  • Right-click on the sheet, select View Code.

  • Go to Insert and select Module from the drop-down menu.

2 Methods to Calculate Gross Profit Margin Percentage with Formula in Excel

  • Copy and paste the VBA code below.

VBA Code:

Function GrossProfitMargin(s As Double, c As Double) As Variant
GrossProfitMargin = ((s - c) / s)
End Function
  • Save the code by pressing Ctrl + S.

2 Methods to Calculate Gross Profit Margin Percentage with Formula in Excel

This will create a function named GrossProfit Margin, and here, s is selling price and c is the cost of goods.

  • The worksheet and select the cell where we want the gross profit margin result to appear. So, we select cell E5.
  • Type the formula we have just created.
=GrossProfitMargin(C5,D5)
  • Press Enter.

C5 is the selling price and D5 is the cost of goods.

  • Get the result in cell E5. The user-defined formula will show in the formula bar.

  • Drag down the Fill Handle over the range of the Gross Profit Margin column.

2 Methods to Calculate Gross Profit Margin Percentage with Formula in Excel

  • The result for Gross Profit Margin Percentage is in column E.


Download Practice Workbook

You can download the workbook and practice with them.


<< Go Back to Formula List | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Sabrina Ayon
Sabrina Ayon

Sabrina Ayon, a Computer Science and Engineering graduate from United International University, has been an integral part of the ExcelDemy project for two years. She authored 150+ articles, excelling in instructing through visually engaging Excel tutorials. With a passion for teaching, Sabrina conducted sessions on Excel VBA, sharing her knowledge and insights with others. Currently holding the position of Project Manager for the ExcelDemy Visual Development Project, she oversees various aspects of the project, ensuring its smooth operation... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo