ARRAYFORMULA Function in☝️ Google Sheets Explained (Definition, Syntax, How to Use It, Examples)

This guide covers everything you need to know about the Google Sheets ARRAYFORMULA function, including its definition, syntax, use cases, and how to use it.

What is the ARRAYFORMULA Function? How Does It Work?

The ARRAYFORMULA function returns an array of values across multiple rows or columns. Its primary function is to display the outcomes of an array formula that involve multiple ranges of the same size or a function that yields a result larger than one cell, enabling the creation of dynamic calculations that can process and manipulate data in bulk.

At its core, the ARRAYFORMULA function works by accepting an array_formula, which can be a range, a mathematical expression involving one or more cell ranges of the same size, or a function that generates a result that spans more than a single cell. It then executes this formula over the entire range or array, returning the resulting array of values.

For instance, consider a scenario where you want to add corresponding values in two different ranges. Instead of creating a formula for each row, you can use the ARRAYFORMULA function. When you input something like ARRAYFORMULA(A1:C1+A2:C2), it adds corresponding values from A1:C1 to A2:C2, displaying the results across multiple cells.

While editing any formula in Google Sheets, pressing Ctrl+Shift+Enter will automatically add ARRAYFORMULA( to the beginning of the formula. This is a shortcut for entering ARRAYFORMULA.

ARRAYFORMULA Syntax

The syntax and arguments for the function are as follows:

ARRAYFORMULA(array_formula)

Here, ‘array_formula’ is the only argument, and it can be a range, a mathematical expression using one cell range or multiple ranges of the same size, or a function that returns a result greater than one cell.

Here are some important usage notes related to the syntax and arguments:

  • The ‘array_formula’ argument is the main input for the ARRAYFORMULA function. It can be a simple range like A1:C3, a mathematical expression like A1:A3+B1:B3, or a function that returns an array result like IF(A1:A3>5, A1:A3, 0).
  • Many array formulas will automatically expand into neighboring cells, eliminating the need for the explicit use of ARRAYFORMULA. This means if your ‘array_formula’ produces an array result, Google Sheets will automatically fill the surrounding cells with the result.
  • It’s important to note that array formulas cannot be exported. This means that if you’re planning to use the sheet data in another application, the array formulas will not work there.
  • The ARRAYFORMULA function is not case-sensitive. This means ARRAYFORMULA and arrayformula are the same.
  • The ARRAYFORMULA function can handle ranges larger than the actual data set. If the range specified in ‘array_formula’ is larger than the data set, ARRAYFORMULA will return an array that includes empty cells.
  • The ARRAYFORMULA function can be nested within other functions to perform complex calculations. However, ensuring that the ranges in the ‘array_formula’ argument match in size is important. If they don’t, ARRAYFORMULA will return an error.

Examples of How to Use the ARRAYFORMULA Function

Here are some practical examples of how to use the ARRAYFORMULA function in Google Sheets:

Example #1: Summing Up a Range of Cells

Let’s say you have a range of numbers in cells A1 to A5 and want to find the sum of these numbers.

Instead of typing =A1+A2+A3+A4+A5, you can use the ARRAYFORMULA function. The formula would be =ARRAYFORMULA(SUM(A1:A5)). This formula will add up all the numbers in the range A1 to A5 and display the result in the cell where you entered the formula.

Example #2: Multiplying a Range of Cells

Suppose you have a range of numbers in cells B1 to B5 and want to find the product of these numbers. Instead of typing =B1*B2*B3*B4*B5, you can use the ARRAYFORMULA function. The formula would be =ARRAYFORMULA(PRODUCT(B1:B5)). This formula will multiply all the numbers in the range B1 to B5 and display the result in the cell where you entered the formula.

Example #3: Applying a Function to Each Cell in a Range

The ARRAYFORMULA function can also be used to apply a function to each cell in a range. For instance, if you have a range of numbers in cells C1 to C5 and you want to square each number, you can use the ARRAYFORMULA function. The formula would be =ARRAYFORMULA(C1:C5^2). This formula will square each number in the range C1 to C5 and display the results in an array in the cell where you entered the formula.

Example #4: Counting Non-Empty Cells in a Range

If you want to count the number of non-empty cells in a range, use the ARRAYFORMULA function with the COUNTA function. For example, if you want to count the number of non-empty cells in the range D1 to D5, you can use the formula =ARRAYFORMULA(COUNTA(D1:D5)). This formula will count the number of non-empty cells in the range D1 to D5 and display the result in the cell where you entered the formula.

Example #5: Combining Text from Multiple Cells

The ARRAYFORMULA function can also be used to combine text from multiple cells. For instance, if you have first names in cells E1 to E5 and last names in cells F1 to F5, and you want to combine them into full names in column C, you can use the formula =ARRAYFORMULA(E1:E5 & ” ” & F1:F5). This formula will combine the first and last names in each row and display the results in an array in the cell where you entered the formula.

ARRAYFORMULA: Common Mistakes & Problems

When using ARRAYFORMULA in Google Sheets, it’s crucial to be aware of common mistakes and problems that can occur. This understanding can help you troubleshoot issues and make the most out of this powerful function. Here are the key points to consider:

  • Incorrect Data Range: One of the most common mistakes is specifying an incorrect data range. If the range does not contain the cells you intend to calculate, the ARRAYFORMULA will not return the results you expect. Always double-check your range to ensure it includes all necessary cells.
  • Mismatched Array Sizes: ARRAYFORMULA requires the arrays being operated on to be the same size. If they are not, you will receive an error. Ensure that the arrays you’re working with have the same dimensions.
  • Not Leaving Enough Space for Output: When ARRAYFORMULA is used, it fills subsequent cells in the column or row with the calculated results. If there is existing data in these cells, it will be overwritten without warning. To avoid losing data, always ensure there is enough empty space for the output of your formula.
  • Forgetting to Use Array-Compatible Functions: Not all functions can be used with ARRAYFORMULA. Only those designed to work with arrays can be used within ARRAYFORMULA. Using non-compatible functions will result in errors.
  • Not Understanding How ARRAYFORMULA Propagates: Unlike standard functions, ARRAYFORMULA calculates values across an entire range of cells at once. If you don’t understand how this propagation works, it can lead to mistakes in your spreadsheets.
  • Using Volatile Functions Within ARRAYFORMULA: Certain functions like NOW(), TODAY(), RAND(), and RANDBETWEEN() recalculate every time the spreadsheet changes. Using them within ARRAYFORMULA can slow down your spreadsheet significantly.

These are some common mistakes and problems that users often encounter when working with ARRAYFORMULA. By being aware of these, you can avoid pitfalls and use the function more effectively.

Why Is ARRAYFORMULA Not Working? Troubleshooting Common Errors

If you encounter issues while working with ARRAYFORMULA in Google Sheets, you’re not alone. Many users experience common errors that can occur due to various reasons, from incorrect input parameters to formula syntax errors. This section will help you understand and troubleshoot these errors.

#VALUE! Error

Cause: This error typically occurs when the input parameter in the nested function in ARRAYFORMULA is invalid or inappropriate. For example, if you provide a string when the function expects a number, you will encounter the #VALUE! error.

Solution: To fix this, ensure your input parameters align with the expected input type. For example, if the ARRAYFORMULA function expects a numerical value, ensure that you provide a number, not a text string.

#REF! Error

Cause: You might encounter this error when you are referencing a cell range that does not exist or is invalid. This can also occur if the resulting array of the ARRAYFORMULA function is too large for the Google Sheets grid.

Solution: To resolve this, make sure that the cell range you are referencing in your formula exists and is valid. Additionally, ensure that the resulting array size does not exceed the maximum number of cells in Google Sheets.

#NUM! Error

Cause: This error typically appears when you are performing numerical operations that result in a number that is too large or too small for Google Sheets to handle.

Solution: To fix this, review your ARRAYFORMULA for operations that might be returning extremely large or small numbers. Adjust these calculations so that they return numbers within the Google Sheets numerical limits.

#N/A Error

Cause: This error generally arises when the ARRAYFORMULA function can’t find the value it’s looking for or when the index exceeds the number of values in the range.

Solution: To solve this, ensure the values you search for exist within the given range. Also, check that your index is not greater than the number of values in your range.

#ERROR! Error

Cause: This is a general error that can occur for various reasons. One common reason is an incorrect syntax or wrong usage of the ARRAYFORMULA function.

Solution: To handle this, revisit your formula to ensure it is syntactically correct. Ensure you are using the ARRAYFORMULA function correctly with the right number and type of arguments.

Using ARRAYFORMULA With Other Google Sheets Functions

Combining ARRAYFORMULA with other Google Sheets functions can supercharge your data analysis and processing capabilities. This function allows you to apply a formula to an entire column or row without having to manually input the formula for each individual cell. Here, we will explore how to use ARRAYFORMULA with other Google Sheets functions.

With SUM

Usage: ARRAYFORMULA can be used with the SUM function to calculate the sum of a range of values within an array.

Example: Suppose you have a list of sales figures in column A and you want to calculate the cumulative sum in column B. You can use the formula =ARRAYFORMULA(SUM($A$1:A1)) in cell B1, and it will automatically fill down the column with the cumulative sum of the sales figures.

With COUNT

Usage: ARRAYFORMULA can be used with the COUNT function to count the number of cells in a range that contain numbers.

Example: If you want to count the number of cells in column A that contain numbers, you can use the formula =ARRAYFORMULA(COUNT(A1:A)). This formula will return the count of cells in column A that contain numbers.

With AVERAGE

Usage: ARRAYFORMULA can be used with the AVERAGE function to calculate the average of a range of numbers within an array.

Example: If you have a list of test scores in column A and want to calculate the average score, you can use the formula =ARRAYFORMULA(AVERAGE(A1:A)). This will return the average of the test scores in column A.

With CONCATENATE

Usage: ARRAYFORMULA can be used with the CONCATENATE function to join two or more text strings into one text string.

Example: If you have a list of first names in column A and last names in column B and want to combine them into full names in column C, you can use the formula =ARRAYFORMULA(A1:A & ” ” & B1:B). This will return a column of full names, with a space between the first and last names.

With VLOOKUP

Usage: ARRAYFORMULA can be used with the VLOOKUP function to look up values in a vertical lookup table.

Example: If you have a table of products and prices in range A1:B10, and you want to look up the price of each product listed in column D, you can use the formula =ARRAYFORMULA(VLOOKUP(D1:D, $A$1:$B$10, 2, FALSE)). This will return a column of prices for the products listed in column D.

For more details on the ARRAYFORMULA function, check out the official documentation at the Google Docs Editors Help Center.

More Google Sheets Tutorials
More Microsoft Excel Tutorials
Share This Post
Daniel Smith
Daniel Smith
Daniel Smith is automation consultant with a passion for technology, data, AI, and machine learning.