Build an invoice that totals itself. SUMPRODUCT multiplies quantity by price across every line in one shot, then a tax line and a grand total finish it — no helper column of line totals needed.
=subtotal * taxRate and a grand total with =subtotal + tax.
The example
Three line items, an 8.25% tax, and the grand total.
| A | B | C | |
|---|---|---|---|
| 1 | Item | Qty | Price |
| 2 | Widget | 3 | $12.00 |
| 3 | Gadget | 2 | $25.00 |
| 4 | Subtotal | $86.00 | |
| 5 | Tax 8.25% | $7.10 | |
| 6 | Total | $93.10 |
The formula
Subtotal, tax, and total:
How it works
SUMPRODUCT does the line math and the sum together:
- SUMPRODUCT multiplies each quantity by its price row by row, then adds the products — the subtotal in one cell.
- No need for a “line total” column unless you want to show it; the formula handles it internally.
- Compute tax on the subtotal and ROUND to 2 decimals so cents don’t drift:
=ROUND(subtotal*rate, 2). - The grand total is simply subtotal plus tax.
Tax only some items? Add a taxable flag column (1/0) and multiply it in: =SUMPRODUCT(B2:B10, C2:C10, D2:D10)*rate taxes only the flagged lines. For a discount, subtract a discount column the same way.
Try it: interactive demo
Enter lines as “qty,price”; set the tax rate.
Variations
Tax only flagged items
1/0 taxable column D:
Apply a discount
Subtract a discount before tax:
Show line totals too
Per-row column:
Pitfalls & errors
Round the tax. Without ROUND(…,2), fractions of a cent accumulate and the printed total can be a penny off.
Equal-length ranges. The qty and price ranges must be the same size, or SUMPRODUCT returns #VALUE!.
Blanks are fine, text isn’t. Empty cells multiply as 0, but text in a number column breaks the product. Keep qty/price columns numeric.
Practice workbook
Frequently asked questions
How do I total an invoice with tax in Excel?
How do I tax only some line items?
Why is my invoice total a penny off?
Stop fighting formulas. Learn them in a day.
This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class