Excel Supreme

Excel track · Exercise 45 of 86 Paid

INDEX: a value at a row and column

Read any single cell of a grid from a row number and a column number.

Intermediate

Three products across three quarters

Read-only data · answer in B7

In B7, read the units at the row in B5 and the column in B6, counting from the first product and from Q1.

ABCD
1ProductQ1Q2Q3
2Widget100120130
3Gadget90110125
4Gizmo140160150
5Row to read3
6Column to read2
7Units

Download this grid (.xlsx) Two tabs: the grid you see, and the answer.

B7

What it does

INDEX reads one cell out of a rectangular block. The block is B2:D4, so Widget's Q1 sits at B2, which is position 1, 1. Counting three rows down and two columns across lands on C4, which holds 160. The result goes in B7.

The count restarts at the top-left corner of whatever range you hand it. Row 1 of the block is sheet row 2, and column 1 is column B, so the 3 and 2 in B5 and B6 count from B2.

Feed those numbers from cells and the same formula follows the question. Change B6 to 3 and B7 reads 150, Gizmo's Q3. Change B5 to 2 and it reads 110, Gadget's Q2. Type 3 and 2 into the formula and B7 keeps answering for a cell nobody asked about.

Syntax

=INDEX(array, row_num, [column_num])

Worked example

On Three products across three quarters, =INDEX(B2:D4,B5,B6) returns 160.

=INDEX(B2:D4,B5,B6)

Common errors

Error codes for INDEX
ErrorWhat it means and how to fix it
#REF!The row or column number points outside B2:D4, as when 9 is asked for from a three-column block.
#VALUE!The row or column argument arrived as text, which INDEX cannot count with.
Wrong cellB5 and B6 went in as column then row, so the formula reads Widget's Q3 at 130 and no error appears.

At work

Reading one quarter of one product out of a sales grid, with the quarter picked from a drop-down.