[rank_math_breadcrumb]
logo-v-light

Our Service

AGGREGATE

In this comprehensive guide, we will explore the AGGREGATE function in Excel, which is a powerful formula that allows you to perform various calculations, such as sum, average, count, and more, on a range of cells while ignoring errors, hidden rows, or other specified conditions. This function is particularly useful when dealing with large datasets that may contain errors or hidden data. We will cover the syntax, examples, tips and tricks, common mistakes, troubleshooting, and related formulae for the AGGREGATE function.

AGGREGATE Syntax

The syntax for the AGGREGATE function in Excel is as follows:

AGGREGATE(function_num, options, array, [k])

Where:

  • function_num is a required argument that specifies the function to be used for the calculation. It is an integer between 1 and 19, each representing a different function (e.g., 1 for AVERAGE, 2 for COUNT, etc.).
  • options is a required argument that determines which values to ignore during the calculation. It is an integer between 0 and 7, each representing a different option (e.g., 0 for ignoring nested SUBTOTAL and AGGREGATE functions, 1 for ignoring hidden rows, etc.).
  • array is a required argument that represents the range of cells on which the calculation will be performed.
  • k is an optional argument used only for specific functions (e.g., LARGE, SMALL, etc.). It specifies the k-th largest or smallest value to be returned.

AGGREGATE Examples

Let’s look at some examples of using the AGGREGATE function in Excel:

  1. Example 1: Calculate the average of a range of cells, ignoring hidden rows and errors. Assume we have a dataset in cells A1:A10, and some rows are hidden or contain errors. To calculate the average, use the following formula:
  2. =AGGREGATE(1, 5, A1:A10)

  3. Example 2: Count the number of non-empty cells in a range, ignoring errors. Assume we have a dataset in cells B1:B20, and some cells contain errors. To count the number of non-empty cells, use the following formula:
  4. =AGGREGATE(2, 4, B1:B20)

  5. Example 3: Find the median of a range of cells, ignoring hidden rows, errors, and nested SUBTOTAL and AGGREGATE functions. Assume we have a dataset in cells C1:C15. To find the median, use the following formula:
  6. =AGGREGATE(12, 7, C1:C15)

  7. Example 4: Find the 3rd largest value in a range of cells, ignoring errors. Assume we have a dataset in cells D1:D25, and some cells contain errors. To find the 3rd largest value, use the following formula:
  8. =AGGREGATE(14, 4, D1:D25, 3)

AGGREGATE Tips & Tricks

Here are some tips and tricks to help you get the most out of the AGGREGATE function in Excel:

  • When using the AGGREGATE function, make sure to choose the appropriate function_num and options values for your specific calculation. Refer to Excel’s documentation for a complete list of available functions and options.
  • If you want to apply multiple conditions for ignoring values, you can use the SUMPRODUCT function in combination with AGGREGATE. For example, to calculate the sum of a range of cells while ignoring errors and values less than 10, use the following formula:
  • =SUMPRODUCT(AGGREGATE(9, 4, A1:A10/(A1:A10>=10), 0))

  • When using the AGGREGATE function with the LARGE or SMALL functions, remember to include the k argument to specify the k-th largest or smallest value you want to return.
  • Keep in mind that the AGGREGATE function is available only in Excel 2010 and later versions.

Common Mistakes When Using AGGREGATE

Here are some common mistakes users make when using the AGGREGATE function in Excel:

  • Using an incorrect function_num or options value. Make sure to double-check the values you are using for these arguments to ensure they match your desired calculation.
  • Forgetting to include the k argument when using the LARGE or SMALL functions. This will result in an error or incorrect result.
  • Using the AGGREGATE function in Excel versions earlier than 2010. This function is not available in earlier versions of Excel, so you will need to use alternative functions, such as SUMIF, COUNTIF, or AVERAGEIF.

Why Isn’t My AGGREGATE Working?

If your AGGREGATE function is not working as expected, consider the following troubleshooting steps:

  • Double-check the function_num and options values to ensure they are correct for your desired calculation.
  • Ensure that the array argument is referencing the correct range of cells.
  • If using the LARGE or SMALL functions, make sure to include the k argument.
  • Check for any errors in the referenced cells that may be causing the AGGREGATE function to return an error or incorrect result.
  • Ensure you are using Excel 2010 or a later version, as the AGGREGATE function is not available in earlier versions.

AGGREGATE: Related Formulae

Here are some related formulae that you may find useful when working with the AGGREGATE function in Excel:

  1. SUMIF: This function calculates the sum of a range of cells that meet a specified condition. For example:
  2. =SUMIF(A1:A10, “>10”)

  3. COUNTIF: This function counts the number of cells in a range that meet a specified condition. For example:
  4. =COUNTIF(B1:B20, “<>0”)

  5. AVERAGEIF: This function calculates the average of a range of cells that meet a specified condition. For example:
  6. =AVERAGEIF(C1:C15, “>=5”)

  7. SUMPRODUCT: This function calculates the sum of the product of corresponding values in two or more arrays. It can be used in combination with AGGREGATE to apply multiple conditions for ignoring values. For example:
  8. =SUMPRODUCT(AGGREGATE(9, 4, A1:A10/(A1:A10>=10), 0))

  9. SUBTOTAL: This function calculates a specified function, such as sum, average, or count, on a range of cells while ignoring any nested SUBTOTAL functions. For example:
  10. =SUBTOTAL(1, D1:D25)

By understanding the AGGREGATE function and its related formulae, you can perform powerful calculations on your data while ignoring errors, hidden rows, or other specified conditions. This makes it an invaluable tool for working with large datasets in Excel.

Related

Did you find this article useful?

Share it with your friends or colleagues

About Aepoch Advisors

We are a boutique accounting and consulting firm servicing international businesses operating in China. We offers book keeping and business advisory service. We also help our clients select and implement SAAS business applications
 
Cloud technology significantly reduces cost foreign companies traditionally spent on tax compliance and ERP systems. Our cloud professionals can help with streamlining your management and controling structure, as well as advising you on how to reduce risks and maximize profits with software purposely built for Chinese business. Contact us today to learn more about our services.