How many times have you created a formula and copied it to the adjacent cells in your sheet? In Google Sheets, you can skip this step by using the ARRAYFORMULA function.
With ARRAYFORMULA in Google Sheets, you can return several values instead of just one. This lets you combine the function with others like SUM, SUMIF, IF, and more to obtain results for an entire cell range.
About Array Formulas
If you aren’t familiar with array formulas, you can simply break down the term. An array is a range of cells arranged in rows and columns. A formula is an equation of sorts that performs an action or calculation on the referenced cell(s).
So when you combine the two, an array formula lets you perform multiple calculations on a group of cells at once. You can obtain a single result or multiple results with an array formula based on the calculations you perform. But many find the greater value in the latter.
To make using array formulas easier, Google Sheets provides a function dedicated to it, the ARRAYFORMULA function.
Use the ARRAYFORMULA in Google Sheets
The syntax for the function is
ARRAYFORMULA(array_formula)where the one and only argument is required. The argument can include a cell range, expression, or function for one or more arrays of the same size.
There are two ways to insert an ARRAYFORMULA formula in Google Sheets.
This first method is ideal when you’ve already typed your formula and realize you want to use the ARRAYFORMULA function instead. Or, for those times when you want to concentrate on the meat of the formula and worry about adding the ARRAYFORMULA function afterward.
With an ordinary formula entered into a cell, place your cursor in or on the formula in the Formula Bar. Then, press Ctrl+Shift+Enter on Windows or Command+Shift+Return on Mac. You’ll see your formula transform into an ARRAYFORMULA formula.
Simply press Enter or Return to apply the converted formula.
The next method for inserting an ARRAYFORMULA formula in Google Sheets is by entering it like any other formula. So, let’s look at some basic examples.
Basic ARRAYFORMULA Examples
For this first example, we’ll do a simple multiplication calculation for a cell range. We’ll take our Quantity Sold and multiply it by the Unit Price. To do this for our entire array, we would use the following formula:
While we have a small cell range for our calculation here, cells B2 through B6 multiplied by cells C2 through C6, imagine if you have hundreds of cells in the array. Rather than inserting a formula that you then need to copy down, just use the ARRAYFORMULA for the array.
For this next example, let’s toss in another function. We’ll add the formula for the IF function as the argument for ARRAYFORMULA. Using the formula below, we will display Bonus if the amount in the cell range F2 through F6 is above 20,000 and No Bonus if it’s not.
=ARRAYFORMULA(IF(F2:F6>20000,"Bonus", "No Bonus"))
Again, we save a step by inserting a single formula that populates for the entire cell range.
In our final example, we’ll combine the SUMIF function with ARRAYFORMULA. Using the formula below, we sum the amounts in cells M2 through M16 if the values in cells O3 through O5 equal those in cells L2 through L16.
Now with this one simple formula, we’re able to get sales totals for only those three products we want. The formula for the ARRAYFORMULA function fills our cells for Shirts, Shorts, and Shoes correctly.
Here you have the basics of using the ARRAYFORMULA function in Google Sheets. So, you can experiment with more complex formulas to achieve the results you need.
Keep in mind this is one of those Google Sheets functions currently unavailable in Microsoft Excel, so take advantage of it!
To use it in Google Sheets, you can either directly type “ARRAYFORMULA” or hit a Ctrl+Shift+Enter shortcut (Cmd + Shift + Enter on a Mac), while your cursor is in the formula bar to make a formula an array formula (Google Sheets will automatically add ARRAYFORMULA to the start of the formula).