Cost of Revenue (Historical)
Returns historical cost of revenue (also known as Cost of Goods Sold or COGS) for a company. This represents the direct costs attributable to producing goods or services sold.
What is Cost of Revenue?
Cost of Revenue includes:
- Direct materials
- Direct labor
- Manufacturing overhead
- For services: direct service delivery costs
Gross Profit = Revenue - Cost of Revenue
Parameters
| Parameter | Required | Description |
|---|---|---|
| Symbol | Yes | Stock ticker symbol |
| Year | Yes | Fiscal year (e.g., 2023) or period code (lq, ly) |
| Quarter | No | Quarter number 1-4 (default: 1) |
| TTM | No | Set to "TTM" for trailing twelve months |
Period Codes
| Code | Meaning |
|---|---|
| lq | Last quarter |
| lq-1 | Two quarters ago |
| ly | Last year |
| ly-1 | Two years ago |
Syntax
=hf_Cost_of_Revenue(Symbol, Year, [Quarter], [TTM])Parameters
Stock ticker symbol
Fiscal year or period code
Calendar quarter (1-4)
Set to 'TTM' for trailing twelve months
Returns
Cost of revenue value
Examples
=hf_Cost_of_Revenue("AAPL", "2023", "4")=hf_Cost_of_Revenue("MSFT", "2023", "3")=hf_Cost_of_Revenue("AAPL", "lq")=hf_Cost_of_Revenue("GOOGL", "2023", "4", "TTM")=hf_Cost_of_Revenue(A1, B1, C1)When to Use
- Analyzing cost structure trends
- Calculating gross margin
- Building financial models
- Comparing operational efficiency
- Profitability analysis
When NOT to Use
| Scenario | Use Instead |
|---|---|
| Need current COGS | CostOfRevenue() |
| Need gross profit | hf_Gross_Profit() |
| Need operating expenses | hf_Operating_Expenses() |
| Need revenue | hf_Revenue() |
| Need net income | hf_Net_Income() |
Common Issues & FAQ
Why am I getting "NA"?
Check that:
- The symbol is valid and has fundamental data available
- The year/quarter combination exists in the data
- The company has reported financials for that period
How do I calculate gross profit?
Gross Profit = Revenue - Cost of Revenue:
=hf_Revenue("AAPL", "2023", "4") - hf_Cost_of_Revenue("AAPL", "2023", "4")
What's included in cost of revenue?
It includes all direct costs of producing goods/services: materials, direct labor, and manufacturing overhead.
Related Formulas
More MarketXLS Historical Fundamentals formulas you can use in the same worksheet:
- Cost of Sales (Historical)
- Cumulative Translation Adjustment (Historical)
- Currency Rate Indicator (Historical)
- Current Assets (Historical)
- Current Assets Per Share (Historical)
- Current Deferred Income Taxes (Historical)
- Current Liabilities (Historical)
- Current Liabilities Per Share (Historical)
See hf_Cost_of_Revenue used in a complete workbook: Cash Conversion Cycle: Formula, Calculation, and Excel Analysis Guide (2026)
