Skip to content

How do you calculate gross margin from a trial balance?

The short answer

Gross margin = (revenue − direct costs) ÷ revenue × 100, where direct costs are opening stock plus purchases and direct expenses, less closing stock.

The step people miss is the stock. A trial balance shows what you bought, not what you sold, so without the closing-stock adjustment the margin is wrong by however much stock moved in the month.

A trial balance shows what you bought, not what you sold

In an invented month, the same ledgers give a 40% margin with the stock adjustment and 35% without it. The five points are $6,000 of stock that was bought and not sold.

US dollarsWith stock adjustedPurchases as cost
Revenue120,000120,000
Opening stock30,000—
Purchases70,00070,000
Direct expenses (freight in)8,0008,000
Less closing stock(36,000)—
Direct costs72,00078,000
Gross profit48,00042,000
Gross margin40%35%

Every figure shown here is invented for illustration. Nothing on this page is computed from anyone’s accounts.

Which ledgers count as direct costs

Purchases of goods for resale or raw materials, freight inward and other direct expenses, and the change in inventory. Direct labour is treated either way, and a report should say which. Rent, salaries of administrative staff, marketing and depreciation are operating expenses: they come after gross profit, not before it. Put one in the wrong place and gross margin and operating costs are both wrong while profit stays the same, which is why nobody notices.

A month's margin needs a month's figures

Income and expense balances in a trial balance run from the start of the financial year. The month’s revenue and direct costs are this month’s closing balances less last month’s, except in the first month of the year. Gross margin on year-to-date balances is a year-to-date margin, which is a different figure.

Mapped once, computed every month

Magic MIS maps each ledger to a report head the first month and keeps the mapping, then computes gross profit as revenue less direct costs and gross margin as gross profit ÷ revenue × 100 for each month. Every figure opens to the ledgers behind it, so a misplaced ledger is visible rather than averaged in.

Read next

Get gross margin from your own trial balance

Create an account, load last month's trial balance, and get the report — paid per action.

Prepaid credits, no subscription. Credits never expire.