AGGREGATE Formula in Excel

If you just need to aggregate formula in excel and move on, the boxed answer at the top is all you need. The rest of this page is for when you want to understand why it works in Excel, adapt it to a trickier version, or make it robust enough to hand to a colleague. We keep the opening short on purpose — the depth is here when you want it, not in your way when you don’t.

Exact answer

In Excel: use =AGGREGATE(9, 6, range) — it runs one of 19 calculations picked by function_num (9 is SUM, 14 LARGE, 15 SMALL), and options decides what is ignored: 6 skips error values, 5 hidden rows, 7 both, which a plain SUM cannot do.

On this page8

Syntax

=AGGREGATE(function_num, options, ref1, ...)

Arguments

Argumentrequired / optionalDescription
function_numrequiredWhich of 19 calculations to run: 9 sums, 1 averages, 14 is LARGE, 15 is SMALL.
optionsrequiredWhat to ignore: 6 skips error values, 5 skips hidden rows, 7 skips both.
ref1requiredThe range to aggregate, or for LARGE/SMALL the range followed by a k argument.

Related functions

SUBTOTALIFERRORCOUNTIF
Annotated stepsExcel
1

Select the result cell and type =AGGREGATE(.

2

Enter the function number — 9 to sum, 1 to average, 14 for LARGE, 15 for SMALL.

3

Add a comma and the options number: 6 to ignore errors, 5 for hidden rows, 7 for both.

4

Add a comma and the range. For LARGE or SMALL, add one more comma and the k you want.

Ctrl+CthenCtrl+Shift+V+Cthen+Ctrl+VPaste values · WindowsMac

Need it as an auditable file?

Ships inside the linked template — formula-driven, unlocked, audit-ready.

View template

What this does

AGGREGATE is SUBTOTAL with two upgrades: it offers 19 calculations instead of 11, and a second argument that says what to ignore. Option 6 skips error values, which is the reason most people find it — it totals a column that contains a stray #N/A without the column-wide IFERROR wrapper that would otherwise be needed. Option 5 skips hidden rows, and 7 skips both. Function numbers 14 and 15 give LARGE and SMALL, so "the third-largest value, ignoring errors" is a single call. It requires Excel 2010 or later. Most people learn this as a sequence of clicks and forget it by next week; learning it as a pattern instead is what lets you apply it to the next, slightly different version of the problem without starting from scratch. That is the difference this page is trying to make. The difference between a quick fix and a sheet you can trust is the extra minute you spend validating “aggregate formula in excel”. Start on a copy or a tiny sample, keep the affected formula visible, and compare the result with the tool above before you touch the real workbook. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. The point is a calculation you can defend to a CFO or an auditor, but the practical win is that someone else can open the file and understand what happened without asking you.

A worked example

A column with a stray #N/A in it still totals correctly with =AGGREGATE(9, 6, D2:D500). The third-largest deal size ignoring errors: =AGGREGATE(14, 6, D2:D500, 3). The smallest visible value in a filtered list: =AGGREGATE(15, 5, D2:D500, 1). AGGREGATE is the one aggregation that survives dirty data, which is why it belongs on any summary sitting on top of a live lookup. If there is any chance you will reuse this, drop it into a small template tab right now: a labelled input area on the left and the formula beside it, checked once against the tool above. Next time the same question comes up, the answer is a single paste away instead of a rebuild from memory.

In Google Sheets

If you are in Google Sheets rather than Excel, the good news is that the formula shown here is identical and the workflow barely changes — menus sit across the top instead of in a ribbon, and a few function names differ slightly, but anything you build here moves across with little or no rework. Keep this page bookmarked for the next time the same question comes up. Better still, repeat the steps once in your own workbook — doing it yourself is what turns a copied answer into something you remember. The short version of “aggregate formula in excel”: the answer is at the top of this page, the tool proves it on your own numbers, and the sections above explain why it holds so the next variation does not stump you. Excel rewards people who reference cells instead of typing values and who keep inputs separate from formulas, because that is what makes a result you can audit months later. Build it once, deliberately, with the live tool as a check, and you convert a one-off lookup into a reusable skill — which is the whole point of learning the why and not just the what.

Common mistakes

  • Omitting the options argument — unlike SUBTOTAL it is required, and leaving it out is an error rather than a default.
  • Forgetting the extra k argument for functions 14 to 19, which need it and error without it.
  • Using AGGREGATE to paper over errors that should be fixed; ignoring an #N/A is right when the data is genuinely incomplete, wrong when a lookup is broken.

Frequently asked questions

How do I sum a column that contains errors?

=AGGREGATE(9, 6, range). Option 6 tells it to skip error values, so no IFERROR wrapper is needed on every row.

What is the difference between AGGREGATE and SUBTOTAL?

AGGREGATE offers 19 calculations to SUBTOTAL's 11 and can ignore errors, which SUBTOTAL cannot. SUBTOTAL is simpler when filtering is all you need.

How do I get the nth largest value ignoring errors?

=AGGREGATE(14, 6, range, n) — function 14 is LARGE and the final argument is the rank you want.