How to Create an Array Formula in Excel – 13 Examples

Get the final sale of values by multiplying sales by the number of the packages:

create array formula excel


What is Array Formula

An array formula can execute many calculations on one or more items and return many results or only one. There are Multiple Cell array formulas and Single-cell array formulas.


Multiple Cells Array Formula

  • Select F5 and enter the following formula:

=C5:C13*D5:D13

  • There is an array symbol in F5:F13.


Single Cell Array Formula

To get the output in a single cell,  enter the following formula in F5.

=C5:C13*D5:D13

The Summation of the sales is displayed in F5.

Multiple Cell Array Formula

Read More: What Is an Array in Excel?


How to Launch the VBA Editor in Excel

Press Alt+F11 or use the Visual Basic command in the Developer tab.

VBA editor launch

  • Select Insert > Module, and you will see the VBA editor to enter the code.

 Insertion of Module

Example 1 – Create a One Dimensional Array Formula with Constant Values in Excel

  • Use the names of different products inside inverted commas and separate each product with semicolons. Enclosed the whole list with second brackets.
  • Enter the formula in B4:

={"Apple";"Orange";"Kiwi";"Tomato";"Banana"}

  • Press ENTER.

This is the output.

One Dimensional Vertical array showing in the range of cells

If you want to enter the name of the products horizontally, change the formula.

  • Enter the following formula in C4:

={"Apple", "Orange", "Kiwi", "Tomato", "Banana"}

The names of different products were used inside inverted commas and separated with commas. The whole list was enclosed with second brackets.

 One dimentional horizontal array initialization

  • Press ENTER.

This is the output.

one dimensional horizontal array showing in cells


Example 2 – Create a Two Dimensional Array Formula with Constant Values in Excel

  • Enter the formula in C3:

={"Apple", "Orange", "Kiwi", "Tomato", "Banana";3981,3849,3003,2652,1275}

The name of the products and the sales values are separated with commas. The final product name is separated by a semicolon from the sales value of the first product.

two dimensional array initialization

  • Press ENTER.

This is the output.

 two dimensionalized array in the dataset


Example 3 – Using the TRANSPOSE Function with an Array Formula to Reverse Rows and Columns

  • Enter the formula in C11:

=TRANSPOSE(B4:C9)

B4:C9 is the range of the rows to transform into columns.

Transpose function implemented to demonstrate the 2 dimensionalized array

  • Press ENTER.

This is the output.

 2 dimensional array after transpose function implemented


Example 4 – Create an Array Formula with the SUM Function in Excel

  • Enter the formula in D10:

=SUM(C5:C9*D5:D9)

C5:C9 is the sales, and D5:D9 is the discounts.

SUM of cells using the SUM array formula

  • Press ENTER.

This is the output.

sum of cells showing after array formula implementation


Example 5 – Create Array Formula with the MAX Function in Excel

  • Enter the formula in D10:

=MAX(D5:D9-C5:C9)

C5:C9 is the Cost Prices, and D5:D9 is the Sales values.

  • Press ENTER.

Max Function implemented to show the summation of the sales value

  • This is the output.

after Max function implemented cellD10 now showing the maximum profit


Example 6 – Create an Array Formula for Multiple Rows in Excel

Calculate the bonus earned by the employees:

  • Use the following formula in F4.

=(D4:D8-C4:C8)*E4:E8

C4:C8 is the Cost Prices, D4:D8 is the Sales values, and E4:E8 is the %.

 array formual for multiple cells are showing

  • Press ENTER.

This is the output.

output showing after array formula applied for multiple cells


Example 7 – Create an Array by Summing the Nth Largest or Smallest Numbers

  • Enter the following formula in E4.

=SUM(LARGE(C4:C8,{1,2}))

C4:C8 is the sales values, and {1,2} extracts the largest two values.

Array formula apply with multiple criteria

  • Enter the following formula in E6 to get the sum of the lowest two sales values.

=SUM(SMALL(C4:C8,{1,2}))

C4:C8 is the sales values, and {1,2} extracts the smallest two values.

SUM and CCOUNTIF function to sum based on criteria


Example 8 – Create an Array with Multiple Criteria in a Formula

Count the total number of times the products Mango and Orange were sold by Lily:

=SUM(COUNTIFS(B4:B12,"Lily",C4:C12,{"Mango","Orange"}))

 output showing the count of number that obey the criteria

Formula Breakdown

  • COUNTIFS(B4:B12,”Lily”,C4:C12,{“Mango”,”Orange”}) → becomes

Output → {0,1}

  • SUM(COUNTIFS(B4:B12,”Lily”,C4:C12,{“Mango”,”Orange”})) → becomes

SUM({0,1})

Output → 1


Example 9 – Combine the IF and SUM Functions to Create an Array Formula in Excel

Calculate the total sales value of the product Mango sold by David:

  • Enter the formula in D15:

=SUM(IF(((B4:B12="David")*(C4:C12="Mango")),(D4:D12)))

If both conditions B4:B12=”David” and C4:C12=”Mango” are met in a row, the corresponding sales values will be extracted and the values will be added.

  • Press ENTER.

This is the output.

Cell D15 showing the summation of the sales based on criteria


Example 10 – Combine the IF Function and the OR Operator to Create an Array Formula in Excel

Calculate the total sales value of the product Mango sold by David:

  • Enter the formula in D15:

=SUM(IF(((B4:B12="David")+(C4:C12="Mango")),(D4:D12)))

If any of the conditions B4:B12=”David” and C4:C12=”Mango” are met in a row, the corresponding sales values is extracted and the values are added.

  • Press ENTER.

Formula implemented to show summation with criteria array function

This is the output.

Criteria highlight for implementing IF with OR operator


Example 11 – Use the ROW Function to Create an Array Formula in Excel

  • Enter the formula in F5:

=SUM(D5:D13/ROW(D5:D13))

  • Press ENTER.

This is the output.

USE of ROW function to calculate average


Example 12 – Create an Array Formula to Count Cells in a Range

  • Enter the formula in E5:

=SUM(--(ISNUMBER(SEARCH("Apple",C5:C13)))*1)

  • Press ENTER.

This is the output.

Use of SUM and ISNUMBER to get Count of Cell


Example 13 – Create an Array Formula to calculate the Average in a Range

  • Enter the formula in F5:

=SUM(D5:D13)/COUNT(D5:D13)

 

  • Press ENTER.

This is the output.

Cell D15 showing the total sales using the IF and OR operator


How to Create a Dynamic Array Formula in Excel – 6 Examples

Example 1 – Using the UNIQUE Function to Create an Array Formula in Excel

Extract the unique names in the SalesPerson column:

  • Enter the following formula in B15.
=UNIQUE(B4:B12)

Using Unique function to sum a dynamic array list values

This is the output.

Using Unique function to sum a dynamic array list values


Example 2 – Use the FILTER Function to Create an Array Formula in Excel

Extract the data for Katy:

  • Enter the formula in B15:
=FILTER(B5:D13,B5:B13="Katy")

B4:D12 is the range, and B4:B12=”Katy” is the criterion for filtering.

  • Press ENTER.

use of the FILTER function to get the dynamic array formula in Excel

This is the output.

Dynamic array solution with formula showing in the range of cell


Example 3 – Applying the SORT and the SORTBY Functions to Create an Array Formula in Excel

  • Use the following function in B15.

=SORT(B4:D12,1,-1)

B4:D12 is the dataset, 1 is the number of the column to be sorted, and -1 returns a descending order.

SQRT function in the formula box

  • Press ENTER.

This is the output.

  • Use the SORTBY function.

=SORTBY(B4:D12,C4:C12,1)

B4:D12 is the dataset, C4:C12 is the column to be sorted, and 1 returns an ascending order.

 use of the SORT by funcion get the sales values based on the salesperson name

  • Click OK.

Salespersons are sorted by Product.


Example 4 – Applying the SEQUENCE Function to Create an Array Formula in Excel

Enter serial numbers from 1 to 9 in a sequence:

  • Enter the following formula in B4.

=SEQUENCE(9,1,1,1)

9 is the total rows, 1 is the column number, 1 is the starting number, and 1 is the step number.

use of the sequence function to get the serial number array


Example 5 – Utilizing the RANDARRAY Function to Create an Array Formula in Excel

Create random serial numbers:

  • Enter the following formula in B4.

=RANDARRAY(9,1,1,9,TRUE)

 use of the RANDARRAY function to get the serial number of the values

Note:

The serial numbers generated by this function will automatically change if you refresh.


Example 6 – Using the XLOOKUP Function to Create an Array Formula in Excel

  • Enter the formula in F5:

=XLOOKUP("Katy",Table1[Salesperson],Table1[Sales],1,0)

  • Press ENTER.

This is the output.

XLOOKUP function to search values from array formula and return value in Excel

Note:

Convert data to a table before applying this method.


Why is the Array Formula Not Working in Excel?

Common issues:

  • Not entering the formula correctly: Press Ctrl+Shift+Enter instead of Enter.
  • Incorrectly referencing cells: If you reference a cell that contains a formula, it will not return an array.
  • Using incompatible formulas: Not all formulas can be used in array formulas.
  • Too much data: Too much data can cause the formula to fail or Excel to crash.
  • Calculation mode:  Make sure your calculation mode is set to Automatic.
  • Conflicting add-ins: Disable add-ins and check if the issue is solved.

Excel Array Constants

There are two types of array constants.

Horizontal Array Constants

  • Enter the following formula in the cell and get the maximum of the array values.

=MAX({5,7,2,9})

Horizontal array constants formula in Excel worksheet

Longitudinal Array Constants

  • Enter the following formula to see the longitudinal array average.

=AVERAGE({10;20;30;40})

Longitudinal array constants formula in Excel worksheet


Limitations of the Array Formulas in Excel

  • Limited editing: Once an array formula is entered into a cell, it cannot be edited like a regular formula. You must edit the entire formula.
  • Limitations on number of elements: Excel has limitations on the number of elements that can be used in an array formula. The maximum number of elements in an array formula is 1,048,576.

Frequently Asked Questions

What does {} do in Excel?

The curly braces {} are used to enclose an array formula.

How do I create an array list in Excel?

Create a Named range and then create a list.

Can Array formulas be entered into a Merged cell?

No. Errors may occur.

array formula in the merged cell in Excel worksheet


Things Need to Remember

  • Array formulas can only be entered in a single cell. The result will be displayed in that cell. However, the formula can reference a range of cells.
  • The curly braces {} must be entered manually when using the formula.
  • Make sure the range of cells referenced in the array formula is the same size and shape as the result you want to return.

Download Practice Workbook

Download the following workbook.


Related Articles


<< Go Back to Array Formula | Excel Formulas | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Tanjima Hossain
Tanjima Hossain

TANJIMA HOSSAIN is a marine engineer who enjoys working with Excel and VBA programming. For her, programming is a handy, time-saving tool for managing data, files, and online tasks. She's skilled in Rhino3D, Maxsurf C++, MS Office, AutoCAD, and Excel & VBA, going beyond the basics. She holds a B.Sc. in Naval Architecture & Marine Engineering from BUET and is now a content developer. In this role, she creates tech-focused content centred around Excel and VBA. Apart from... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo