Farmers Market: Sales Tax Collected By Category

Excel Formulas › Farmers Market Vendor

All versions

Raw produce is sales-tax exempt in most states; prepared food, crafts and value-added goods usually are not. A vendor selling across all three needs to total tax only on the taxable rows, and SUMPRODUCT does that in a single formula — multiplying each row's sales by 1 if taxable and 0 if exempt, then by the tax rate, and summing the result without a helper column.


Quick formula: SUMPRODUCT turns the Yes/No taxable flag into 1s and 0s, multiplies by sales and the tax rate, and sums it:
=SUMPRODUCT((B2:B5="Yes")*C2:C5*D2:D5)

Only the taxable rows (baked goods and crafts) contribute; produce and honey, both exempt, contribute zero.

Functions used (tap for the full reference guide):

The example

One Saturday's sales across four categories at an 8.25% local rate. Two categories are tax-exempt.

ABCDE
1CategoryTaxable?SalesRateTax due
2ProduceNo4508.25%$0.00
3Baked goodsYes3008.25%$24.75
4CraftsYes2208.25%$18.15
5HoneyNo1508.25%$0.00

The formula

The comparison inside SUMPRODUCT does the filtering, no IF needed:

=SUMPRODUCT((B2:B5="Yes")*C2:C5*D2:D5) // taxable flag (1/0) times sales times rate, summed

How it works

Three arrays multiply together element by element, then sum:

  1. (B2:B5="Yes") compares each cell in the range to the text "Yes" and produces an array of TRUE/FALSE, which Excel treats as 1/0 the moment it is multiplied.
  2. *C2:C5 multiplies each row's sales by its 1-or-0 taxable flag, zeroing out the exempt rows (produce, honey) while leaving taxable rows (baked goods, crafts) unchanged.
  3. *D2:D5 applies the tax rate to what is left, row by row.
  4. SUMPRODUCT adds every element of the resulting array together in one step, without needing an array-entered formula or a helper column to hold the intermediate taxable-sales figures.

Add a SUM of just the tax-due column as a cross-check — if it does not match the SUMPRODUCT total, a rate or a Yes/No flag was typed wrong somewhere.

Try it: interactive demo

Interactive

Enter sales for a taxable and an exempt category, and the tax rate.

Variations

Same total with SUMIF, no array math

If every taxable row shares one rate, SUMIF is simpler than SUMPRODUCT — sum just the taxable sales, then multiply by the rate once at the end.

=SUMIF(B2:B5,"Yes",C2:C5)*D2

Different rate per category

Drop the shared-rate assumption and multiply each row by its own rate column directly — SUMPRODUCT already supports this exactly as written above.

=SUMPRODUCT((B2:B5="Yes")*C2:C5*D2:D5)

Pitfalls & errors

SUMPRODUCT ranges must all be the same size (same number of rows). Mixing B2:B5 with C2:C6 by one extra row silently misaligns the multiplication and produces a wrong, not obviously wrong, total.

Typing "yes" in lowercase in one row and "Yes" in another is not a problem — Excel's = comparison is not case-sensitive — but a trailing space ("Yes ") IS a mismatch and will silently zero out that row. TRIM the taxable column if it is typed by hand.

Keep the taxable/exempt flag as its own column rather than folding the logic into the tax rate (for example, entering 0% for exempt rows). A dedicated Yes/No column is auditable at a glance; a zeroed-out rate looks like a data-entry mistake.

Practice workbook

📊
Download the free Farmers Market: Sales Tax Collected By Category practice workbook
Edit the yellow sales and taxable cells; tax due and the total recalculate.

Frequently asked questions

Does SUMPRODUCT need to be entered with Ctrl+Shift+Enter like an array formula?
No — SUMPRODUCT is one of the few functions built to handle array math natively. Type it and press Enter normally; it works on every Excel version without the CSE array-entry step.
What if a state taxes some prepared food but not others?
Add a more specific category column (or split "prepared food" into sub-categories) so each row's Yes/No flag is accurate at the level your state actually draws the line, rather than approximating an entire category as uniformly taxable or exempt.

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

Related formulas: Farmers Market: Units To Sell To Cover The Booth Fee · Weighted Average Price with SUMPRODUCT · Auditing: Check Percentages Sum to 100%

Function references: SUMPRODUCTSUMIF