fxExcelReps

← Blog

6 Excel array formulas every analyst should know

After 17 years of working with Excel in banking, I can say that array formulas are the moment Excel stops being a static grid and becomes a real analysis tool. One array formula can replace a helper column, a filter and a manual check — and it updates itself when the data changes.

This article shows six array formulas I use all the time. Every example has a live sheet: click a cell, change the data or the formula, and see the result immediately.

What is an array formula?

A normal formula works with one value at a time. An array formula works with a whole range at once. For example, A2:A6="apple" doesn't return one TRUE or FALSE — it returns a list of five: one for each cell.

Functions like OR, SUM, MAX or AVERAGE can then collapse that list into a single answer.

Which Excel version? In Microsoft 365 and Excel 2021+ array formulas just work — type them and press Enter. In Excel 2019 and older, confirm them with Ctrl + Shift + Enter. Excel then shows them in curly braces {=...}. Never type the braces yourself.

Commas or semicolons? This article uses commas (,) between arguments. If your Excel uses semicolons (common in Europe, e.g. Bulgarian or German settings), write ; instead: =IF(OR(D2=A2:A6);"Found";"Not found").

1. Is a value in the list? (ignoring upper/lower case)

The problem: you want to know if a product appears in a list, without a helper column.

=IF(OR(D2=A2:A6), "Found", "Not found")

How it works:

  1. D2=A2:A6 compares D2 with every cell in the list → {TRUE; FALSE; FALSE; FALSE; FALSE}.
  2. OR(...) returns TRUE if at least one comparison is TRUE.
  3. IF turns it into a readable answer.

Excel comparisons ignore case, so apple finds Apple.

{"cells": {"A1": "Fruit", "A2": "Apple", "A3": "Banana", "A4": "Cherry", "A5": "Mango", "A6": "Kiwi",
           "D1": "Look for", "D2": "apple", "E1": "Result", "E2": "=IF(OR(D2=A2:A6),\"Found\",\"Not found\")"},
 "focus": "E2", "note": "Change D2 to \"kiwi\" or \"Pear\" and watch E2."}

Simpler alternative: =IF(COUNTIF(A2:A6, D2)>0, "Found", "Not found") does the same without an array.

2. The same check — but case-sensitive

The problem: product codes like ab-12 and AB-12 are different items, but a normal comparison treats them as equal.

=IF(OR(EXACT(D2, A2:A6)), "Found", "Not found")

EXACT compares two texts including upper and lower case. Given a whole range, it returns one TRUE/FALSE per cell, and OR checks if any of them is TRUE. COUNTIF can't do this — it always ignores case.

{"cells": {"A1": "Fruit", "A2": "Apple", "A3": "Banana", "A4": "Cherry", "A5": "Mango", "A6": "Kiwi",
           "D1": "Look for", "D2": "apple", "E1": "Any case", "E2": "=IF(OR(D2=A2:A6),\"Found\",\"Not found\")",
           "F1": "Exact case", "F2": "=IF(OR(EXACT(D2,A2:A6)),\"Found\",\"Not found\")"},
 "focus": "F2", "note": "Change D2 to \"Apple\" — now both formulas find it."}

3. Average without the zeros

The problem: months without sales are recorded as 0, and they drag the average down.

=AVERAGE(IF(B2:B9<>0, B2:B9))

How it works:

  1. B2:B9<>0 marks every non-zero value with TRUE.
  2. IF(..., B2:B9) keeps the value where it's TRUE and returns FALSE where it's 0.
  3. AVERAGE ignores FALSE — so only the real values are averaged.
{"cells": {"A1": "Month", "B1": "Sales", "A2": "Jan", "B2": 1200, "A3": "Feb", "B3": 0, "A4": "Mar", "B4": 950,
           "A5": "Apr", "B5": 0, "A6": "May", "B6": 1430, "A7": "Jun", "B7": 1100, "A8": "Jul", "B8": 640, "A9": "Aug", "B9": 1430,
           "D1": "Average", "E1": "=AVERAGE(B2:B9)", "D2": "Without zeros", "E2": "=AVERAGE(IF(B2:B9<>0,B2:B9))"},
 "focus": "E2", "note": "The difference between E1 and E2 is the effect of the two empty months."}

Simpler alternative: =AVERAGEIF(B2:B9, "<>0"). The array version is still worth knowing — you can put any condition inside the IF, e.g. IF((B2:B9<>0)*(A2:A9<>"Aug"), B2:B9).

4. The sum of the top N values

The problem: you need the total of the best 3 months, the top 5 sales reps or the 2 biggest invoices.

=SUM(LARGE(B2:B9, SEQUENCE(3)))

LARGE(range, k) returns the k-th largest value. Give it several k's at once — SEQUENCE(3) produces {1; 2; 3} — and it returns the 1st, 2nd and 3rd largest. SUM adds them up.

In older Excel (no SEQUENCE), the classic trick is:

=SUM(LARGE(B2:B9, ROW(INDIRECT("1:3"))))

ROW(INDIRECT("1:3")) creates the list {1; 2; 3}. INDIRECT is used because a plain ROW(1:3) would change if someone inserted a row above. For a fixed small N you can also write the list directly: LARGE(B2:B9, {1,2,3}).

{"cells": {"A1": "Month", "B1": "Sales", "A2": "Jan", "B2": 1200, "A3": "Feb", "B3": 0, "A4": "Mar", "B4": 950,
           "A5": "Apr", "B5": 0, "A6": "May", "B6": 1430, "A7": "Jun", "B7": 1100, "A8": "Jul", "B8": 640, "A9": "Aug", "B9": 1430,
           "D1": "Top 3 total", "E1": "=SUM(LARGE(B2:B9,SEQUENCE(3)))", "D2": "Top 2 total", "E2": "=SUM(LARGE(B2:B9,ROW(A1:A2)))"},
 "focus": "E1", "note": "Change SEQUENCE(3) to SEQUENCE(5) for the top 5."}

5. The exact address of the largest value

The problem: you know the maximum, but where is it? In a big table, the cell address helps you jump straight to it.

=ADDRESS(MIN(IF(B2:B9=MAX(B2:B9), ROW(B2:B9))),
         MIN(IF(B2:B9=MAX(B2:B9), COLUMN(B2:B9))))

How it works:

  1. B2:B9=MAX(B2:B9) marks the cell (or cells) holding the maximum.
  2. IF(..., ROW(B2:B9)) keeps the row number of those cells.
  3. MIN takes the first one — if the maximum appears twice, you get the top one.
  4. The same for COLUMN, and ADDRESS(row, column) turns the two numbers into a reference like $B$6.

Because it uses both ROW and COLUMN, the formula also works on a two-dimensional range such as B2:M50.

{"cells": {"A1": "Month", "B1": "Sales", "A2": "Jan", "B2": 1200, "A3": "Feb", "B3": 0, "A4": "Mar", "B4": 950,
           "A5": "Apr", "B5": 0, "A6": "May", "B6": 1430, "A7": "Jun", "B7": 1100, "A8": "Jul", "B8": 640, "A9": "Aug", "B9": 1430,
           "D1": "Max is in", "E1": "=ADDRESS(MIN(IF(B2:B9=MAX(B2:B9),ROW(B2:B9))),MIN(IF(B2:B9=MAX(B2:B9),COLUMN(B2:B9))))",
           "D2": "Which month", "E2": "=INDEX(A2:A9,MATCH(MAX(B2:B9),B2:B9,0))"},
 "focus": "E1", "note": "May and Aug share the maximum — the formula returns the first one. Change B6 to 1000 and see."}

If you need the label rather than the address, =INDEX(A2:A9, MATCH(MAX(B2:B9), B2:B9, 0)) returns the month directly.

6. The longest text in a column

The problem: you're designing a report or a database field and need to know the longest name, address or description.

=INDEX(A2:A6, MATCH(MAX(LEN(A2:A6)), LEN(A2:A6), 0))

How it works:

  1. LEN(A2:A6) returns the length of every text → {5; 6; 6; 5; 4}.
  2. MAX(...) finds the longest length → 6.
  3. MATCH(6, {5; 6; 6; 5; 4}, 0) finds its position → 2.
  4. INDEX(A2:A6, 2) returns that text → Banana.
{"cells": {"A1": "Fruit", "A2": "Apple", "A3": "Banana", "A4": "Cherry", "A5": "Mango", "A6": "Kiwi",
           "C1": "Longest", "D1": "=INDEX(A2:A6,MATCH(MAX(LEN(A2:A6)),LEN(A2:A6),0))", "C2": "Length", "D2": "=MAX(LEN(A2:A6))"},
 "focus": "D1", "note": "Type \"Passion fruit\" in A6 and the answer changes instantly."}

In older Excel you'll see this written with a named range: {=INDEX(Data, MATCH(MAX(LEN(Data)), LEN(Data), FALSE), 1)} — the same logic, confirmed with Ctrl + Shift + Enter.

Quick reference

Task Formula
Value in list (any case) =IF(OR(D2=A2:A6),"Found","Not found")
Value in list (exact case) =IF(OR(EXACT(D2,A2:A6)),"Found","Not found")
Average without zeros =AVERAGE(IF(B2:B9<>0,B2:B9))
Sum of top N =SUM(LARGE(B2:B9,SEQUENCE(N)))
Address of the maximum =ADDRESS(MIN(IF(rng=MAX(rng),ROW(rng))),MIN(IF(rng=MAX(rng),COLUMN(rng))))
Longest text =INDEX(rng,MATCH(MAX(LEN(rng)),LEN(rng),0))

Practise the building blocks

Every formula above is built from functions you can practise on ExcelReps: IF, OR, AVERAGE, LARGE, INDEX, MATCH and LEN. Master them one by one, and array formulas become easy to read and write.

Practise the functions from this article

Every function has a short explanation and exercises in a real spreadsheet — your first 3 are free.

Start for free →

More articles

VLOOKUP vs XLOOKUP: 4 Traps That Give Wrong Answers

VLOOKUP can return a balance for an account that does not exist, with no error. Four traps from real banking reports and how XLOOKUP fixes them.

How to Fix Excel Errors: #N/A, #VALUE!, #REF! (Game)

What #N/A, #VALUE!, #REF!, #DIV/0! and #NAME? mean in Excel and how to fix each one. Then beat the clock: fix 10 broken formulas before 5 PM.

Free Loan Amortization Schedule Template for Excel

Download a free Excel loan amortization schedule with extra payments, payoff date, total interest and a balance chart. Type your loan and it updates instantly.