Gross Margin (Historical)

Returns the historical gross margin (gross profit margin) for a company. This ratio measures the percentage of revenue remaining after cost of goods sold.

Formula

Gross Margin = (Revenue - Cost of Revenue) / Revenue = Gross Profit / Revenue

Parameters

Parameter Required Description
Symbol Yes Stock ticker symbol
Year Yes Fiscal year or period code
Quarter No Quarter 1-4
TTM No "TTM" for trailing twelve months

Return Value

  • Returns as decimal (0.45 = 45%)
  • Higher values indicate better pricing power

Syntax

=hf_Gross_Margin(Symbol, Year, [Quarter], [TTM])
Excel Desktop (Windows)

Parameters

symbolstringRequired

Stock ticker symbol

yearstringRequired

Fiscal year or period code

quarterstring

Calendar quarter (1-4)

TTMstring

Set to 'TTM' for trailing twelve months

Returns

number

Gross margin as decimal (0.45 = 45%)

Examples

=hf_Gross_Margin("AAPL", 2023, 4)
Q4 2023 gross margin
=hf_Gross_Margin("MSFT", "ly")
Last year gross margin
=hf_Gross_Margin("GOOGL", 2023, , "TTM")
TTM gross margin
=hf_Gross_Margin("AAPL", 2023)*100
Convert to percentage (45%)

When to Use

  • Analyzing pricing power
  • Comparing profitability across companies
  • Tracking margin trends
  • Industry benchmarking

When NOT to Use

Scenario Use Instead
Operating margin hf_Operating_Margin()
Net profit margin hf_Profit_Margin()
Gross profit amount hf_Gross_Profit()

Common Issues & FAQ

Why is the value less than 1?

Gross margin is returned as a decimal. Multiply by 100 for percentage.

Why do software companies have high gross margins?

Software has minimal cost of goods sold compared to physical products.

Excel Templates Using Gross Margin (Historical)

These ready-made MarketXLS templates call hf_Gross_Margin() in their worksheet formulas. Open one to see the function working inside a complete model.

Get Access to 1 Billion Usable Market data points IN YOUR EXCEL SHEETS WITH EASY TO USE EXCEL FUNCTIONS

Get started today
MarketXLS Excel Add-in Tutorial - How to Use Gross Margin (Historical) and Other Financial Formulas
How does MarketXLS work?