search
HomeSoftware TutorialOffice SoftwareHow to Use Excel's AGGREGATE Function to Refine Calculations

  • The AGGREGATE Syntax
  • Example 1: Using AGGREGATE to Ignore Errors
  • Example 2: Using AGGREGATE to Ignore Hidden Rows (Reference)
  • Example 3: Using AGGREGATE to Ignore Hidden Rows (Array)
  • Things to Note When Using the AGGREGATE Function

Excel's AGGREGATE function lets you perform calculations whilst ignoring hidden rows, errors, or other functions that appear in the data. It's similar to the SUBTOTAL function but provides more calculation options and gives you more control over what you want to exclude from the calculation.

The AGGREGATE Syntax

Before we look at some examples of the AGGREGATE function in use, let's see how it works. The AGGREGATE function has two syntaxes—one for references and one for arrays—though you don't need to get yourself tied up in knots over which one you're using, as Excel selects the relevant one depending on the arguments you input. You can see both syntaxes in use when I show you some examples soon.

The Reference Form Syntax

The syntax for the reference form of the AGGREGATE function is:

=AGGREGATE(<em>a</em>,<em>b</em>,<em>c</em>,<em>d</em>)

where

  • a (required) is a number that represents the function you want to use in the calculation,
  • b (required) is a number that defines what you want the calculation to ignore,
  • c (required) is the range of cells on which the function will be applied, and
  • d (optional) is the first of up to 252 additional arguments that specify further ranges.

The Array Form Syntax

On the other hand, if you're working with arrays, the syntax is:

=AGGREGATE(<em>a</em>,<em>b</em>,<em>c</em>,<em>d</em>)

where

  • a (required) is a number that represents the function you want to use in the calculation,
  • b (required) is a number that defines what you want the calculation to ignore,
  • c (required) is the array of values on which the function will be applied, and
  • d is the second argument required by array functions like LARGE, SMALL, PERCENTILE.INC, and others.

Functions and Exclusions (Arguments a and b)

When entering arguments a and b in either syntax form above, you'll have various options to choose from.

The table below shows the different functions you can use in the AGGREGATE calculation (argument a). Even though you might be tempted to type the function name, remember that this argument must be a number that represents the function you want to use. Functions 1 to 13 are for use with the reference form syntax, and functions 14 to 19 are for use with the array form syntax.

Number

Function

What It Calculates

1

AVERAGE

The arithmetic mean

2

COUNT

The number of cells that contain numeric values

3

COUNTA

The number of cells that are not empty

4

MAX

The largest value

5

MIN

The smallest value

6

PRODUCT

A multiplication

7

STDEV.S

The simple standard deviation

8

STDEV.P

The population-based standard deviation

9

SUM

An addition

10

VAR.S

The simple variation

11

VAR.P

The population-based variance

12

MEDIAN

The middle value

13

MODE.SNGL

The most frequently occurring number

14

LARGE

The nth largest value

15

SMALL

The nth smallest value

16

PERCENTILE.INC

The nth percentile, with the first and last values included

17

QUARTILE.INC

The nth quartile, with the first and last values included

18

PERCENTILE.EXC

The nth percentile, with the first and last values excluded

19

QUARTILE.EXC

The nth quartile, with the first and last values excluded

This table lists the numbers you can input to exclude certain values when creating your AGGREGATE formula (argument b):

Number

What Is Ignored

0

Nested SUBTOTAL and AGGREGATE functions

1

Hidden rows, and nested SUBTOTAL and AGGREGATE functions

2

Errors, and nested SUBTOTAL and AGGREGATE functions

3

Hidden rows, error values, and nested SUBTOTAL and AGGREGATE functions

4

Nothing

5

Hidden rows only

6

Errors only

7

Hidden rows and errors

Now, let's look at some examples of how you can use the AGGREGATE function in real-world scenarios.

Example 1: Using AGGREGATE to Ignore Errors

This Excel spreadsheet contains a list of soccer players, the number of games they've played, the number of goals they've scored, and their game-per-goal ratios. Your aim is to work out the average game-per-goal ratio for all the players combined.

How to Use Excel's AGGREGATE Function to Refine Calculations

If you were to use the AVERAGE function alone by typing:

=AVERAGE(Player_Goals[Games per goal])

into cell C1, this would return an error, because the referenced range contains #DIV/0! errors.

How to Use Excel's AGGREGATE Function to Refine Calculations

How to Use Excel's AGGREGATE Function to Refine Calculations

Related
How to Fix Common Formula Errors in Microsoft Excel

Find out what that error means and how to fix it.

Instead, using the AGGREGATE function gives you the option to ignore these errors and return the average for the remaining data. To do this, in cell C2, you need to type:

=AGGREGATE(1,6,Player_Goals[Games per goal])

where

  • 1 (argument a) represents the AVERAGE function,
  • 6 (argument b) tells Excel to ignore errors, and
  • Player_Goals[Games per goal] is the reference.

How to Use Excel's AGGREGATE Function to Refine Calculations

Example 2: Using AGGREGATE to Ignore Hidden Rows (Reference)

Using the same spreadsheet, your next target is to calculate the total number of goals the team has scored.

Example 3: Using AGGREGATE to Ignore Hidden Rows (Array)

Next, let's say you wanted to list the two highest goal tallies for players who have played 20 games or fewer.

How to Use Excel's AGGREGATE Function to Refine Calculations

You could apply the filter first and then generate your formula, but for the purposes of this demonstration, let's create the formula first.

In cell C1, type:

=AGGREGATE(14,5,Player_Goals[Goals scored],{1;2})

where

  • 14 (argument a) represents the LARGE function,
  • 5 (argument b) tells Excel to ignore hidden rows,
  • Player_Goals[Goals scored] is the array of values, and
  • {1;2} tells Excel that you want it to return the largest (1) and second-largest values (2) on separate rows (;).

When you press Enter, notice that the result is a spilled array covering cells C1 and C2 because you told Excel to return the top two values.

How to Use Excel's AGGREGATE Function to Refine Calculations

How to Use Excel's AGGREGATE Function to Refine Calculations

Related
Everything You Need to Know About Spill in Excel

It's not worth crying over spilled references.

Now, filter the Games Played column to include only those players who have played 20 games or fewer, and see that the result of the AGGREGATE formula you entered earlier changes to ignore the hidden rows.

How to Use Excel's AGGREGATE Function to Refine Calculations

Things to Note When Using the AGGREGATE Function

Before you go ahead and use the AGGREGATE function in your own Excel workbooks, take a moment to note the following pointers:

  • Excel's AGGREGATE function works with vertical ranges only, not horizontal ranges. So, when you reference a horizontal range, AGGREGATE will not ignore rows in hidden columns.
  • Argument c in the AGGREGATE formula cannot be the same cell or range of cells across multiple worksheets (also known as 3D references).
  • Even though the AGGREGATE function is a great way to bypass errors in calculations, don't get into the habit of ignoring errors altogether. They're there for a reason and could help you troubleshoot issues with your data.
  • The array form of the AGGREGATE function will not ignore hidden rows, nested subtotals, or nested aggregates if the array argument includes a calculation.

Another way to hide rows in Excel tables so that the AGGREGATE function only includes what's showing is by inserting slicers, interactive buttons that you can click to make filtering much more straightforward.

The above is the detailed content of How to Use Excel's AGGREGATE Function to Refine Calculations. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Microsoft 365 Will Turn Off ActiveX, Because Hackers Keep Using ItMicrosoft 365 Will Turn Off ActiveX, Because Hackers Keep Using ItApr 12, 2025 am 06:01 AM

Microsoft 365 is finally phasing out ActiveX, a long-standing security vulnerability in its Office suite. This follows a similar move in Office 2024. Beginning this month, Windows versions of Word, Excel, PowerPoint, and Visio in Microsoft 365 will

How to Use Excel's AGGREGATE Function to Refine CalculationsHow to Use Excel's AGGREGATE Function to Refine CalculationsApr 12, 2025 am 12:54 AM

Quick Links The AGGREGATE Syntax

How to Use the PIVOTBY Function in ExcelHow to Use the PIVOTBY Function in ExcelApr 11, 2025 am 12:56 AM

Quick Links The PIVOTBY Syntax

How to Format a Spilled Array in ExcelHow to Format a Spilled Array in ExcelApr 10, 2025 pm 12:01 PM

Use formula conditional formatting to handle overflow arrays in Excel Direct formatting of overflow arrays in Excel can cause problems, especially when the data shape or size changes. Formula-based conditional formatting rules allow automatic formatting to be adjusted when data parameters change. Adding a dollar sign ($) before a column reference applies a rule to all rows in the data. In Excel, you can apply direct formatting to the values ​​or background of a cell to make the spreadsheet easier to read. However, when an Excel formula returns a set of values ​​(called overflow arrays), applying direct formatting will cause problems if the size or shape of the data changes. Suppose you have this spreadsheet with overflow results from the PIVOTBY formula,

You Need to Know What the Hash Sign Does in Excel FormulasYou Need to Know What the Hash Sign Does in Excel FormulasApr 08, 2025 am 12:55 AM

Excel Overflow Range Operator (#) enables formulas to be automatically adjusted to accommodate changes in overflow range size. This feature is only available for Microsoft 365 Excel for Windows or Mac. Common functions such as UNIQUE, COUNTIF, and SORTBY can be used in conjunction with overflow range operators to generate dynamic sortable lists. The pound sign (#) in the Excel formula is also called the overflow range operator, which instructs the program to consider all results in the overflow range. Therefore, even if the overflow range increases or decreases, the formula containing # will automatically reflect this change. How to list and sort unique values ​​in Microsoft Excel

How to Create a Timeline Filter in ExcelHow to Create a Timeline Filter in ExcelApr 03, 2025 am 03:51 AM

In Excel, using the timeline filter can display data by time period more efficiently, which is more convenient than using the filter button. The Timeline is a dynamic filtering option that allows you to quickly display data for a single date, month, quarter, or year. Step 1: Convert data to pivot table First, convert the original Excel data into a pivot table. Select any cell in the data table (formatted or not) and click PivotTable on the Insert tab of the ribbon. Related: How to Create Pivot Tables in Microsoft Excel Don't be intimidated by the pivot table! We will teach you basic skills that you can master in minutes. Related Articles In the dialog box, make sure the entire data range is selected (

How to Use the GROUPBY Function in ExcelHow to Use the GROUPBY Function in ExcelApr 02, 2025 am 03:51 AM

Excel's GROUPBY function: Powerful data grouping and aggregation tools Excel's GROUPBY function allows you to group and aggregate data based on specific fields in a data table. It also provides parameters that allow you to sort and filter the data so that you can customize the output to your specific needs. GROUPBY function syntax The GROUPBY function contains eight parameters: =GROUPBY(a,b,c,d,e,f,g,h) Parameters a to c are required: a (row field): A range (one column or multiple columns) containing the value or category to which the data is grouped. b (value): The range of values ​​containing aggregated data (one column or multiple columns).

Don't Hide and Unhide Columns in Excel—Use Groups InsteadDon't Hide and Unhide Columns in Excel—Use Groups InsteadApr 01, 2025 am 12:38 AM

Excel efficient grouping: say goodbye to hidden columns and embrace flexible data management! While hidden columns can temporarily remove unnecessary data, grouping columns are often a better choice when dealing with large data sets or pursuing flexibility. This article will explain in detail the advantages and operation methods of Excel column grouping to help you improve data management efficiency. Why is grouping better than hiding? Hiding columns (right-click on the column title and select "Hide") can easily lead to data forgetting, even the column title prompt is not reliable because the title itself can be deleted. In contrast, grouped columns are faster and more convenient to expand and fold, which not only improves work efficiency, but also enhances user experience, especially when multi-person collaboration. Additionally, grouping columns allow creation of subgroups, which cannot be achieved by hidden columns. This is the number

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.