The INDEX function returns a value or the reference to a value from within a table or range.
There are two ways to use the INDEX function:
-
If you want to return the value of a specified cell or array of cells, see Array form.
-
If you want to return a reference to specified cells, see Reference form.
Array form
Description
Returns the value of an element in a table or an array, selected by the row and column number indexes.
Use the array form if the first argument to INDEX is an array constant.
Syntax
INDEX(array, row_num, [column_num])
The array form of the INDEX function has the following arguments:
-
array Required. A range of cells or an array constant.
-
If array contains only one row or column, the corresponding row_num or column_num argument is optional.
-
If array has more than one row and more than one column, and only row_num or column_num is used, INDEX returns an array of the entire row or column in array.
-
-
row_num Required, unless column_num is present. Selects the row in array from which to return a value. If row_num is omitted, column_num is required.
-
column_num Optional. Selects the column in array from which to return a value. If column_num is omitted, row_num is required.
Remarks
-
If both the row_num and column_num arguments are used, INDEX returns the value in the cell at the intersection of row_num and column_num.
-
row_num and column_num must point to a cell within array; otherwise, INDEX returns a #REF! error.
-
If you set row_num or column_num to 0 (zero), INDEX returns the array of values for the entire column or row, respectively. To use values returned as an array, enter the INDEX function as an array formula.
Note: If you have a current version of Microsoft 365, then you can input the formula in the top-left-cell of the output range, then press ENTER to confirm the formula as a dynamic array formula. Otherwise, the formula must be entered as a legacy array formula by first selecting the output range, input the formula in the top-left-cell of the output range, then press CTRL+SHIFT+ENTER to confirm it. Excel inserts curly brackets at the beginning and end of the formula for you. For more information on array formulas, see Guidelines and examples of array formulas.
Examples
Example 1
These examples use the INDEX function to find the value in the intersecting cell where a row and a column meet.
Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter.
Data |
Data |
|
---|---|---|
Apples |
Lemons |
|
Bananas |
Pears |
|
Formula |
Description |
Result |
=INDEX(A2:B3,2,2) |
Value at the intersection of the second row and second column in the range A2:B3. |
Pears |
=INDEX(A2:B3,2,1) |
Value at the intersection of the second row and first column in the range A2:B3. |
Bananas |
Example 2
This example uses the INDEX function in an array formula to find the values in two cells specified in a 2×2 array.
Note: If you have a current version of Microsoft 365, then you can input the formula in the top-left-cell of the output range, then press ENTER to confirm the formula as a dynamic array formula. Otherwise, the formula must be entered as a legacy array formula by first selecting two blank cells, input the formula in the top-left-cell of the output range, then press CTRL+SHIFT+ENTER to confirm it. Excel inserts curly brackets at the beginning and end of the formula for you. For more information on array formulas, see Guidelines and examples of array formulas.
Formula |
Description |
Result |
---|---|---|
=INDEX({1,2;3,4},0,2) |
Value found in the first row, second column in the array. The array contains 1 and 2 in the first row and 3 and 4 in the second row. |
2 |
Value found in the second row, second column in the array (same array as above). |
4 |
|
Top of Page
Reference form
Description
Returns the reference of the cell at the intersection of a particular row and column. If the reference is made up of non-adjacent selections, you can pick the selection to look in.
Syntax
INDEX(reference, row_num, [column_num], [area_num])
The reference form of the INDEX function has the following arguments:
-
reference Required. A reference to one or more cell ranges.
-
If you are entering a non-adjacent range for the reference, enclose reference in parentheses.
-
If each area in reference contains only one row or column, the row_num or column_num argument, respectively, is optional. For example, for a single row reference, use INDEX(reference,,column_num).
-
-
row_num Required. The number of the row in reference from which to return a reference.
-
column_num Optional. The number of the column in reference from which to return a reference.
-
area_num Optional. Selects a range in reference from which to return the intersection of row_num and column_num. The first area selected or entered is numbered 1, the second is 2, and so on. If area_num is omitted, INDEX uses area 1. The areas listed here must all be located on one sheet. If you specify areas that are not on the same sheet as each other, it will cause a #VALUE! error. If you need to use ranges that are located on different sheets from each other, it is recommended that you use the array form of the INDEX function, and use another function to calculate the range that makes up the array. For example, you could use the CHOOSE function to calculate which range will be used.
For example, if Reference describes the cells (A1:B4,D1:E4,G1:H4), area_num 1 is the range A1:B4, area_num 2 is the range D1:E4, and area_num 3 is the range G1:H4.
Remarks
-
After reference and area_num have selected a particular range, row_num and column_num select a particular cell: row_num 1 is the first row in the range, column_num 1 is the first column, and so on. The reference returned by INDEX is the intersection of row_num and column_num.
-
If you set row_num or column_num to 0 (zero), INDEX returns the reference for the entire column or row, respectively.
-
row_num, column_num, and area_num must point to a cell within reference; otherwise, INDEX returns a #REF! error. If row_num and column_num are omitted, INDEX returns the area in reference specified by area_num.
-
The result of the INDEX function is a reference and is interpreted as such by other formulas. Depending on the formula, the return value of INDEX may be used as a reference or as a value. For example, the formula CELL(«width»,INDEX(A1:B2,1,2)) is equivalent to CELL(«width»,B1). The CELL function uses the return value of INDEX as a cell reference. On the other hand, a formula such as 2*INDEX(A1:B2,1,2) translates the return value of INDEX into the number in cell B1.
Examples
Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter.
Fruit |
Price |
Count |
---|---|---|
Apples |
$0.69 |
40 |
Bananas |
$0.34 |
38 |
Lemons |
$0.55 |
15 |
Oranges |
$0.25 |
25 |
Pears |
$0.59 |
40 |
Almonds |
$2.80 |
10 |
Cashews |
$3.55 |
16 |
Peanuts |
$1.25 |
20 |
Walnuts |
$1.75 |
12 |
Formula |
Description |
Result |
=INDEX(A2:C6, 2, 3) |
The intersection of the second row and third column in the range A2:C6, which is the contents of cell C3. |
38 |
=INDEX((A1:C6, A8:C11), 2, 2, 2) |
The intersection of the second row and second column in the second area of A8:C11, which is the contents of cell B9. |
1.25 |
=SUM(INDEX(A1:C11, 0, 3, 1)) |
The sum of the third column in the first area of the range A1:C11, which is the sum of C1:C11. |
216 |
=SUM(B2:INDEX(A2:C6, 5, 2)) |
The sum of the range starting at B2, and ending at the intersection of the fifth row and the second column of the range A2:A6, which is the sum of B2:B6. |
2.42 |
Top of Page
See Also
VLOOKUP function
MATCH function
INDIRECT function
Guidelines and examples of array formulas
Lookup and reference functions (reference)
This article explains in simple terms how to use INDEX and MATCH together to perform lookups. It takes a step-by-step approach, first explaining INDEX, then MATCH, then showing you how to combine the two functions together to create a dynamic two-way lookup. There are more advanced examples further down the page.
INDEX function | MATCH function | INDEX and MATCH | 2-way lookup | Left lookup | Case-sensitive | Closest match | Multiple criteria | More examples
The INDEX Function
The INDEX function in Excel is fantastically flexible and powerful, and you’ll find it in a huge number of Excel formulas, especially advanced formulas. But what does INDEX actually do? In a nutshell, INDEX retrieves the value at a given location in a range. For example, let’s say you have a table of planets in our solar system (see below), and you want to get the name of the 4th planet, Mars, with a formula. You can use INDEX like this:
=INDEX(B3:B11,4)
INDEX returns the value in the 4th row of the range.
Video: How to look things up with INDEX
What if you want to get the diameter of Mars with INDEX? In that case, we can supply both a row number and a column number, and provide a larger range. The INDEX formula below uses the full range of data in B3:D11, with a row number of 4 and column number of 2:
=INDEX(B3:D11,4,2)
INDEX retrieves the value at row 4, column 2.
To summarize, INDEX gets a value at a given location in a range of cells based on numeric position. When the range is one-dimensional, you only need to supply a row number. When the range is two-dimensional, you’ll need to supply both the row and column number.
At this point, you may be thinking «So what? How often do you actually know the position of something in a spreadsheet?»
Exactly right. We need a way to locate the position of things we’re looking for.
Enter the MATCH function.
The MATCH function
The MATCH function is designed for one purpose: find the position of an item in a range. For example, we can use MATCH to get the position of the word «peach» in this list of fruits like this:
=MATCH("peach",B3:B9,0)
MATCH returns 3, since «Peach» is the 3rd item. MATCH is not case-sensitive.
MATCH doesn’t care if a range is horizontal or vertical, as you can see below:
=MATCH("peach",C4:I4,0)
Same result with a horizontal range, MATCH returns 3.
Video: How to use MATCH for exact matches
Important: The last argument in the MATCH function is match_type. Match_type is important and controls whether matching is exact or approximate. In many cases you will want to use zero (0) to force exact match behavior. Match_type defaults to 1, which means approximate match, so it’s important to provide a value. See the MATCH page for more details.
INDEX and MATCH together
Now that we’ve covered the basics of INDEX and MATCH, how do we combine the two functions in a single formula? Consider the data below, a table showing a list of salespeople and monthly sales numbers for three months: January, February, and March.
Let’s say we want to write a formula that returns the sales number for February for a given salesperson. From the discussion above, we know we can give INDEX a row and column number to retrieve a value. For example, to return the February sales number for Frantz, we provide the range C3:E11 with a row 5 and column 2:
=INDEX(C3:E11,5,2) // returns $5194
But we obviously don’t want to hardcode numbers. Instead, we want a dynamic lookup.
How will we do that? The MATCH function of course. MATCH will work perfectly for finding the positions we need. Working one step at a time, let’s leave the column hardcoded as 2 and make the row number dynamic. Here’s the revised formula, with the MATCH function nested inside INDEX in place of 5:
=INDEX(C3:E11,MATCH("Frantz",B3:B11,0),2)
Taking things one step further, we’ll use the value from H2 in MATCH:
=INDEX(C3:E11,MATCH(H2,B3:B11,0),2)
MATCH finds «Frantz» and returns 5 to INDEX for row.
To summarize:
- INDEX needs numeric positions.
- MATCH finds those positions.
- MATCH is nested inside INDEX.
Let’s now tackle the column number.
Two-way lookup with INDEX and MATCH
Above, we used the MATCH function to find the row number dynamically, but hardcoded the column number. How can we make the formula fully dynamic, so we can return sales for any given salesperson in any given month? The trick is to use MATCH twice – once to get a row position, and once to get a column position.
From the examples above, we know MATCH works fine with both horizontal and vertical arrays. That means we can easily find the position of a given month with MATCH. For example, this formula returns the position of March, which is 3:
=MATCH("Mar",C2:E2,0) // returns 3
But of course we don’t want to hardcode any values, so let’s update the worksheet to allow the input of a month name, and use MATCH to find the column number we need. The screen below shows the result:
A fully dynamic, two-way lookup with INDEX and MATCH.
=INDEX(C3:E11,MATCH(H2,B3:B11,0),MATCH(H3,C2:E2,0))
The first MATCH formula returns 5 to INDEX as the row number, the second MATCH formula returns 3 to INDEX as the column number. Once MATCH runs, the formula simplifies to:
=INDEX(C3:E11,5,3)
and INDEX correctly returns $10,525, the sales number for Frantz in March.
Note: you could use Data Validation to create dropdown menus to select salesperson and month.
Video: How to do a two-way lookup with INDEX and MATCH
Video: How to debug a formula with F9 (to see MATCH return values)
Left lookup
One of the key advantages of INDEX and MATCH over the VLOOKUP function is the ability to perform a «left lookup». Simply put, this just means a lookup where the ID column is to the right of the values you want to retrieve, as seen in the example below:
Read a detailed explanation here.
Case-sensitive lookup
By itself, the MATCH function is not case-sensitive. However, you use the EXACT function with INDEX and MATCH to perform a lookup that respects upper and lower case, as shown below:
Read a detailed explanation here.
Note: this is an array formula and must be entered with control + shift + enter, except in Excel 365.
Closest match
Another example that shows off the flexibility of INDEX and MATCH is the problem of finding the closest match. In the example below, we use the MIN function together with the ABS function to create a lookup value and a lookup array inside the MATCH function. Essentially, we use MATCH to find the smallest difference. Then we use INDEX to retrieve the associated trip from column B.
Read a detailed explanation here.
Note: this is an array formula and must be entered with control + shift + enter, except in Excel 365.
Multiple criteria lookup
One of the trickiest problems in Excel is a lookup based on multiple criteria. In other words, a lookup that matches on more than one column at the same time. In the example below, we are using INDEX and MATCH and boolean logic to match on 3 columns: Item, Color, and Size:
Read a detailed explanation here. You can use this same approach with XLOOKUP.
Note: this is an array formula and must be entered with control + shift + enter, except in Excel 365.
More examples of INDEX + MATCH
Here are some more basic examples of INDEX and MATCH in action, each with a detailed explanation:
- Basic INDEX and MATCH exact (features Toy Story)
- Basic INDEX and MATCH approximate (grades)
- Two-way lookup with INDEX and MATCH (approximate match)
Функция INDEX (ИНДЕКС) в Excel используется для получения данных из таблицы, при условии что вы знаете номер строки и столбца, в котором эти данные находятся.
Например, в таблице ниже, вы можете использовать эту функцию для того, чтобы получить результаты экзамена по Физике у Андрея, зная номер строки и столбца, в которых эти данные находятся.
Содержание
- Что возвращает функция
- Синтаксис
- Аргументы функции
- Дополнительная информация
- Примеры использования функции ИНДЕКС в Excel
- Пример 1. Ищем результаты экзамена по физике для Алексея
- Пример 2. Создаем динамический поиск значений с использованием функций ИНДЕКС и ПОИСКПОЗ
- Пример 3. Создаем динамический поиск значений с использованием функций INDEX (ИНДЕКС) и MATCH (ПОИСКПОЗ) и выпадающего списка
- Пример 4. Использование трехстороннего поиска с помощью INDEX (ИНДЕКС) / MATCH (ПОИСКПОЗ)
Что возвращает функция
Возвращает данные из конкретной строки и столбца табличных данных.
Синтаксис
=INDEX (array, row_num, [col_num]) — английская версия
=INDEX (array, row_num, [col_num], [area_num]) — английская версия
=ИНДЕКС(массив; номер_строки; [номер_столбца]) — русская версия
=ИНДЕКС(ссылка; номер_строки; [номер_столбца]; [номер_области]) — русская версия
Аргументы функции
- array (массив) — диапазон ячеек или массив данных для поиска;
- row_num (номер_строки) — номер строки, в которой находятся искомые данные;
- [col_num] ([номер_столбца]) (необязательный аргумент) — номер колонки, в которой находятся искомые данные. Этот аргумент необязательный. Но если в аргументах функции не указаны критерии для row_num (номер_строки), необходимо указать аргумент col_num (номер_столбца);
- [area_num] ([номер_области]) — (необязательный аргумент) — если аргумент массива состоит из нескольких диапазонов, то это число будет использоваться для выбора всех диапазонов.
Дополнительная информация
- Если номер строки или колонки равен “0”, то функция возвращает данные всей строки или колонки;
- Если функция используется перед ссылкой на ячейку (например, A1), она возвращает ссылку на ячейку вместо значения (см. примеры ниже);
- Чаще всего INDEX (ИНДЕКС) используется совместно с функцией MATCH (ПОИСКПОЗ);
- В отличие от функции VLOOKUP (ВПР), функция INDEX (ИНДЕКС) может возвращать данные как справа от искомого значения, так и слева;
- Функция используется в двух формах — Массива данных и Формы ссылки на данные:
— Форма «Массива» используется когда вы хотите найти значения, основанные на конкретных номерах строк и столбцов таблицы;
— Форма «Ссылок на данные» используется при поиске значений в нескольких таблицах (используете аргумент [area_num] ([номер_области]) для выбора таблицы и только потом сориентируете функцию по номеру строки и столбца.
Примеры использования функции ИНДЕКС в Excel
Пример 1. Ищем результаты экзамена по физике для Алексея
Предположим, у вас есть результаты экзаменов в табличном виде по нескольким студентам:
Для того, чтобы найти результаты экзамена по физике для Андрея нам нужна формула:
=INDEX($B$3:$E$9,3,2) — английская версия
=ИНДЕКС($B$3:$E$9;3;2) — русская версия
В формуле мы определили аргумент диапазона данных, где мы будем искать данные $B$3:$E$9. Затем, указали номер строки “3”, в которой находятся результаты экзамена для Андрея, и номер колонки “2”, где находятся результаты экзамена именно по физике.
Пример 2. Создаем динамический поиск значений с использованием функций ИНДЕКС и ПОИСКПОЗ
Не всегда есть возможность указать номера строки и столбца вручную. У вас может быть огромная таблица данных, отображение данных которой вы можете сделать динамическим, чтобы функция автоматически идентифицировала имя или экзамен, указанные в ячейках, и дала правильный результат.
Пример динамического отображения данных ниже:
Для динамического отображения данных мы используем комбинацию функций INDEX (ИНДЕКС) и MATCH (ПОИСКПОЗ).
Вот такая формула поможет нам добиться результата:
=INDEX($B$3:$E$9,MATCH($G$4,$A$3:$A$9,0),MATCH($H$3,$B$2:$E$2,0)) — английская версия
=ИНДЕКС($B$3:$E$9;ПОИСКПОЗ($G$4;$A$3:$A$9;0);ПОИСКПОЗ($H$3;$B$2:$E$2;0)) — русская версия
В формуле выше, не используя сложного программирования, мы с помощью функции MATCH (ПОИСКПОЗ) сделали отображение данных динамическим.
Динамический отображение строки задается следующей частью формулы —
MATCH($G$4,$A$3:$A$9,0) — английская версия
ПОИСКПОЗ($G$4;$A$3:$A$9;0) — русская версия
Она сканирует имена студентов и определяет значение поиска ($G$4 в нашем случае). Затем она возвращает номер строки для поиска в наборе данных. Например, если значение поиска равно Алексей, функция вернет “1”, если это Максим, оно вернет “4” и так далее.
Динамическое отображение данных столбца задается следующей частью формулы —
MATCH($H$3,$B$2:$E$2,0) — английская версия
ПОИСКПОЗ($H$3;$B$2:$E$2;0) — русская версия
Она сканирует имена объектов и определяет значение поиска ($H$3 в нашем случае). Затем она возвращает номер столбца для поиска в наборе данных. Например, если значение поиска Математика, функция вернет “1”, если это Физика, функция вернет “2” и так далее.
Больше лайфхаков в нашем Telegram Подписаться
Пример 3. Создаем динамический поиск значений с использованием функций INDEX (ИНДЕКС) и MATCH (ПОИСКПОЗ) и выпадающего списка
На примере выше мы вручную вводили имена студентов и названия предметов. Вы можете сэкономить время на вводе данных, используя выпадающие списки. Это актуально, когда количество данных огромное.
Используя выпадающие списки, вам нужно просто выбрать из списка имя студента и функция автоматически найдет и подставит необходимые данные.
Пример ниже:
Используя такой подход, вы можете создать удобный дашборд, например для учителя. Ему не придется заниматься фильтрацией данных или прокруткой листа со студентами, для того чтобы найти результаты экзамена конкретного студента, достаточно просто выбрать имя и результаты динамически отразятся в лаконичной и удобной форме.
Для того, чтобы осуществить динамическую подстановку данных с использованием функций INDEX (ИНДЕКС) и MATCH (ПОИСКПОЗ) и выпадающего списка, мы используем ту же формулу, что в Примере 2:
=INDEX($B$3:$E$9,MATCH($G$4,$A$3:$A$9,0),MATCH($H$3,$B$2:$E$2,0)) — английская версия
=ИНДЕКС($B$3:$E$9;ПОИСКПОЗ($G$4;$A$3:$A$9;0);ПОИСКПОЗ($H$3;$B$2:$E$2;0)) — русская версия
Единственное отличие, от Примера 2, мы на месте ввода имени и предмета создадим выпадающие списки:
- Выбираем ячейку, в которой мы хотим отобразить выпадающий список с именами студентов;
- Кликаем на вкладку “Data” => Data Tools => Data Validation;
- В окне Data Validation на вкладке “Settings” в подразделе Allow выбираем “List”;
- В качестве Source нам нужно выбрать диапазон ячеек, в котором указаны имена студентов;
- Кликаем ОК
Теперь у вас есть выпадающий список с именами студентов в ячейке G5. Таким же образом вы можете создать выпадающий список с предметами.
Пример 4. Использование трехстороннего поиска с помощью INDEX (ИНДЕКС) / MATCH (ПОИСКПОЗ)
Функция INDEX (ИНДЕКС) может быть использована для обработки трехсторонних запросов.
Что такое трехсторонний поиск?
В приведенных выше примерах мы использовали одну таблицу с оценками для студентов по разным предметам. Это пример двунаправленного поиска, поскольку мы используем две переменные для получения оценки (имя студента и предмет).
Теперь предположим, что к концу года студент прошел три уровня экзаменов: «Вступительный», «Полугодовой» и «Итоговый экзамен».
Трехсторонний поиск — это возможность получить отметки студента по заданному предмету с указанным уровнем экзамена.
Вот пример трехстороннего поиска:
В приведенном выше примере, кроме выбора имени студента и названия предмета, вы также можете выбрать уровень экзамена. Основываясь на уровне экзамена, формула возвращает соответствующее значение из одной из трех таблиц.
Для таких расчетов нам поможет формула:
=INDEX(($B$3:$E$7,$B$11:$E$15,$B$19:$E$23),MATCH($G$4,$A$3:$A$7,0),MATCH($H$3,$B$2:$E$2,0),IF($H$2=»Вступительный»,1,IF($H$2=»Полугодовой»,2,3))) — английская версия
=ИНДЕКС(($B$3:$E$7;$B$11:$E$15;$B$19:$E$23);ПОИСКПОЗ($G$4;$A$3:$A$7;0);ПОИСКПОЗ($H$3;$B$2:$E$2;0); ЕСЛИ($H$2=»Вступительный»;1;ЕСЛИ($H$2=»Полугодовой»;2;3))) — русская версия
Давайте разберем эту формулу, чтобы понять, как она работает.
Эта формула принимает четыре аргумента. Функция INDEX (ИНДЕКС) — одна из тех функций в Excel, которая имеет более одного синтаксиса.
=INDEX (array, row_num, [col_num]) — английская версия
=INDEX (array, row_num, [col_num], [area_num]) — английская версия
=ИНДЕКС(массив; номер_строки; [номер_столбца]) — русская версия
=ИНДЕКС(ссылка; номер_строки; [номер_столбца]; [номер_области]) — русская версия
По всем вышеприведенным примерам мы использовали первый синтаксис, но для трехстороннего поиска нам нужно использовать второй синтаксис.
Рассмотрим каждую часть формулы на основе второго синтаксиса.
- array (массив) – ($B$3:$E$7,$B$11:$E$15,$B$19:$E$23):Вместо использования одного массива, в данном случае мы использовали три массива в круглых скобках.
- row_num (номер_строки) – MATCH($G$4,$A$3:$A$7,0): функция MATCH (ПОИСКПОЗ) используется для поиска имени студента для ячейки $G$4 из списка всех студентов.
- col_num (номер_столбца) – MATCH($H$3,$B$2:$E$2,0): функция MATCH (ПОИСКПОЗ) используется для поиска названия предмета для ячейки $H$3 из списка всех предметов.
- [area_num] ([номер_области]) – IF($H$2=”Вступительный”,1,IF($H$2=”Полугодовой”,2,3)): Значение номера области сообщает функции INDEX (ИНДЕКС), какой массив с данными выбрать. В этом примере у нас есть три массива в первом аргументе. Если вы выберете «Вступительный» из раскрывающегося меню, функция IF (ЕСЛИ) вернет значение “1”, а функция INDEX (ИНДЕКС) выберут 1-й массив из трех массивов ($B$3:$E$7).
Уверен, что теперь вы подробно изучили работу функции INDEX (ИНДЕКС) в Excel!
When you need to obtain a value that resides in a particular spot in your spreadsheet, you’ll want one of Excel’s lookup and reference functions. Here, we’ll show you how to find values by location with INDEX in Excel.
You might be creating a complex formula or have values that change often. By using the INDEX function, you designate the cell range along with a row number and column number. Excel locates the value at that intersection and provides the result from the formula.
The INDEX Function in Excel
You can use the INDEX function two different ways in Excel: Array Form and Reference Form.
Array Form provides the value of a certain cell range, or array. Reference Form provides a reference to specific cells and is useful when working with nonadjacent cells.
Let’s look at how to use both.
Use INDEX in Array Form
The syntax for the function in Array Form is INDEX(array, row_number, column_number)
where the first two arguments are required and column_number
is optional.
To find the value in the third row in the cell range C1 through C10, you would enter the following formula replacing the cell references with your own.
=INDEX(C1:C10,3)
The number 3 here represents the third row. You don’t need the column number argument because the array is in a single column, C.
To find the value in the third row and fifth column for the cell range A1 through E10, you would use this formula.
=INDEX(A1:E10,3,5)
Here, the 3
represents the third row and the 5
represents the fifth column. Because the array covers several columns, you should include the column number argument.
RELATED: How to Number Rows in Microsoft Excel
Use INDEX in Reference Form
The syntax for the function in Reference Form is INDEX(reference, row_number, column_number, area_number)
where the first two arguments are required and second two are optional.
You can use a basic formula with the Reference Form of the function as with the Array Form. With the following formula, you receive the value in the third row and fifth column of cells A1 through E10, just like above.
=INDEX(A1:E10,3,5)
So, let’s look at a more robust formula with this form of the INDEX function using nonadjacent cells.
We’re using two cell ranges here, A1 through E4 (first area) and A7 through E10 (second area). To find the value in the third row and fourth column in the first area, you would enter this formula:
=INDEX((A1:E4,A7:E10),3,4,1)
In this formula, you see the two areas, 3
for the third row, 4
for the fourth column, and 1
for the first area A1 through E4.
To find the value using the same cell ranges, row number, and column number, but in the second area instead of the first, you would use this formula:
=INDEX((A1:E4,A7:E10),3,4,2)
As you can see, everything remains the same except you replace the 1
with a 2
for the second area.
The INDEX function in Excel is a handy one to keep in mind. If you plan to use lookup and reference functions often, be sure to check out how to use VLOOKUP for a range of values and how to use XLOOKUP in Excel.
This post will guide you how to use Excel INDEX function with syntax and examples in Microsoft excel.
Table of Contents
- Description
- Syntax
- Excel INDEX Function Example
- More Excel INDEX Formula Examples
Description
The Excel INDEX function returns a value from a table based on the index (row number and column number). You can use INDEX function to extract entire rows or entire columns. This function is used to combine with the MATCH function to lookup value in a range or array.
The INDEX function is a build-in function in Microsoft Excel and it is categorized as a Lookup and Reference Function.
The INDEX function is available in Excel 2016, Excel 2013, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000, Excel 2011 for Mac.
Syntax
There are two ways to use the INDEX function in excel:
If you want to get the value of a specified cell or array of cell, you can refer to Array form.
If you want to get a reference to specified cells, you can refer to Reference form.
The syntax of the INDEX function is as below:
= INDEX (array, row_num,[column_num]) #Array form =INDEX(reference, row_num,[column_num],[area_num) #Reference form
The array form is used in most cases, and if the first argument of the INDEX function is an array constant, you need to use the array form. If you want to perform a three-way lookup in a range, you can use the reference form.
Where the INDEX function arguments are:
- array -This is a required argument. A range of cells or data array. If array contains only one row or column, the corresponding row_num or Column_num argument is optional.
- Row_num – The row number in data array. If Row_num is omitted, column_num is required.
- Column_num – The column position in data array. If Column_num is omitted, row_num is required.
- Area_num – it is set as a number. If the first argument point to more cell ranges, if area_num is set to 1, then the first area will be selected.
Note:
- If you set the row_num and column_num at the same time, the INDEX function will return the value in the cell at the intersection of row number and column number.
- If you set the value of row_num or column_num to 0, the INDEX function will return the array of values for the entire row or column in the array data.
- Row_num and Column_num must point to a cell within array data, if not, the index function returns #REF!
Excel INDEX Function Example
The below examples will show you how to use Excel INDEX Lookup and Reference Function to return a value from a table based on the intersection of row number and column number.
#1 To get the value at the intersection of the second row and second column in the table array: A1:C2, just using the following excel formula:
=INDEX(A1:C2,2,1)
#2 use reference form to extract a value form the second area of C2:D5. Using the following formula.
=INDEX((B1:C5,C2:D5),2,2,2)
You will see that the intersection of the second row and second column in the second area of C2:D5, which is the contents of cell D3. It returns 149.
More Excel INDEX Formula Examples
- Get the First Match in Two Excel Ranges
If you want to find the first match between two excel ranges, you can use a combination of the INDEX function, the MATCH function and COUNTIF function to create a new formula…. - Extract a List of Unique Values from a Column Range
f you want to extract a list of unique items from a column or range, you can use a combination of the IFERROR function, the INDEX function, the MATCH function and the COUNTIF function to create an array formula….. - Find the Relative Position in a Range or Table
If you want to know the relative row position for all rows in an Excel Range (B3:D6), you can use a excel Array formula as follows:=ROW(B3:D6)- ROW(B3) + 1. You can also use another excel array formula to get the same result as follows:=ROW(B3:D6)-ROW(INDEX(B3:D6,1,1))+1… - Get the Last Row Number in a Range
If you want to get the last row number in a range, you need to know the first row number and the total rows number of a range, then perform the addition operation, then subtract 1, the last result is the last row number for that range.… - Get the First Row Number in a Range
If the ROW function use a Range as its argument, it only returns the first row number.You can also use the ROW function within the MIN function to get the first row number in a range. You can also use the INDEX function to get the reference of the first row in a range, then combined to the ROW function to get the first row number of a range.… - Get the position of Last Occurrence of a value in a column
If you want to find the position number of the last occurrence of a specific value in a column (a single range), you can use an array formula with a combination of the MAX function, IF function, ROW function and INDEX Function. - Lookup the Next Largest Value
If you want to get the next largest value in another column, you can use a combination of the INDEX function and the MATCH function to create an excel formula. You can use the following formula:=INDEX(A2:A5,MATCH(200,A2:A5)+1)… - Reverse a List or Range
If you want to reverse a list or range, you can use a combination of the INDEX function, the COUNTA function, the ROW function or ROWS function to create a new formula. you can use the following formula:=INDEX($A$2:$A$5,COUNTA($A$2:$A$5)-ROWS($C$2:C2)+1)… - Lookup the Value with Multiple Criteria
If you want to lookup the value with multiple criteria in a range, you can use a combination with the INDEX function and MATCH function to create an array formula… - Transpose Values Based on the Multiple Lookup Criteria
If you want to lookup the value with multiple criteria, and then transpose the last results, you can use the INDEX function with the MATCH function to create a new formula.… - Get nth Match with One Criteria using INDEX/MATCH
if you want to find the 2th occurrence of the member “jenny” in the range B2:B10 and extracts its relative bonus value in the range D2:D10, you can used the following array formula:=INDEX(D2:D10, SMALL(IF(B2:B10=”jenny”, ROW(B2:B10)-ROW(INDEX(B2:B10,1,1))+1),2))… - Find the nth Largest Value
To get the 1st, 2nd, 3rd, or nth largest value in a range (single column, or row), you can use the LARGE function… - Find the nth Smallest Value
You can use the SMALL function to get the 1st, 2nd, 3rd, or nth smallest value in an array or range. Also you can use the SMALL function within the INDEX function to extract the relative value of the same row… - Extract the Entire Column of a Matched Value
If you want to lookup value in a range and then retrieve the entire row, you can use a combination of the INDEX function and the MATCH function to create a new excel formula..… - Lookup Entire Row using INDEX/MATCH
If you want to lookup entire row and then return all values of the matched row, you can use a combination of the INDEX function and the MATCH function to create a new excel array formula. - Find nth Occurrence with Multiple Criteria Using INDEX/MATCH
If you want to find the nth occurrence with multiple criteria, you can use a combination with the INDEX function, SMALL function, nested IF function and ROW function to create a complex excel formula like this:=INDEX(Array,SMALL(IF(Range1… - Two-way Lookup Formula
If you want to look up a value in a table using both rows and columns, you can use a combination with the INDEX function and the MATCH function to create an excel formula.… - SUM a Column with Lookup value in a Range
If you want to lookup value in a range and then retrieve the entire row, you can use the MATCH function within the INDEX function… - Get Cell Address of a Lookup Value
If you want to lookup a value in a range or column and return the cell address of the first match of lookup value, you can use a combination with the CELL function, the INDEX function and the MATCH function…. - Transpose Multiple Columns into One Column
You can use the following excel formula to transpose multiple columns that contain a range of data into a single column, and you can also write an Excel VBA Macro to transpose the data of range in B1:D4 into single column F quickly… - Flip a Column of Data Vertically
How do I remove time part from a date in Excel. How to get only date part from the date with time values via Format cells feature or Excel function. How to extract date from a date and time with VBA code in Excel…. - Finding the Max and Min value in an Alphanumeric Data
if you want to find the Maximal or minimal string value from an alphanumeric data list in the range B1:B5, you can create a formula based on the LOOKUP function and the COUNTIF function.…. - Sum Specific Row or Column in Named Range
Assuming that you have a name range “excelhow”, if you want to sum a specific row (row 2) in named range, you need to create a formula based on the SUM function and the OFFSET function and the COLUMNS function to achieve the reuslt…. - Randomly Select Cells
If you want to randomly select cells from a range of cells, you can use a formula based on the INDEX function, the RANDBETWEEN function and the Rows function….. - List all Worksheet Names
Assuming that you have a workbook that has hundreds of worksheets and you want to get a list of all the worksheet names in the current workbook. And the below will introduce 3 methods with you..… - Split Data in One Column to Multiple Columns
If you want to split each sets in one column from row to row in stacked columns, and you need to create a formula based on the OFFSET function, the COLUMNS function, and the ROWS function..… - VLOOKUP Return Multiple Values Horizontally
You can create a complex array formula based on the INDEX function, the SMALL function, the IF function, the ROW function and the COLUMN function to vlookup a value and then return multiple corresponding values horizontally in Excel.… - Copy and Paste Only Non-blank Cells
If you want only copy non-blank cells in a range in Excel, you need to select the non-blank cells firstly, then press Ctrl +C keys to copy the selected cells. So how to only select all non-blank cells in the selected range in your worksheet..… - Generate All Possible Combinations of Two Lists
You can use a formula based on the IF function, the ROW function, the COUNTA function, The INDEX function and the MOD function to get a list of all possible combinations from those two list…. - Find Closest Value or Nearest Value in a Range
You need to use an excel array formula based on the INDEX function, the MATCH function, the MIN function and the ABS function to find Closest Value or Nearest Value in a Range in Excel…