Data indexing in excel

The INDEX function returns a value or the reference to a value from within a table or range.

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

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)

Функция INDEX (ИНДЕКС) в Excel используется для получения данных из таблицы, при условии что вы знаете номер строки и столбца, в котором эти данные находятся.

Например, в таблице ниже, вы можете использовать эту функцию для того, чтобы получить результаты экзамена по Физике у Андрея, зная номер строки и столбца, в которых эти данные находятся.

Функция INDEX в Excel - 1

Содержание

  1. Что возвращает функция
  2. Синтаксис
  3. Аргументы функции
  4. Дополнительная информация
  5. Примеры использования функции ИНДЕКС в Excel
  6. Пример 1. Ищем результаты экзамена по физике для Алексея
  7. Пример 2. Создаем динамический поиск значений с использованием функций ИНДЕКС и ПОИСКПОЗ
  8. Пример 3. Создаем динамический поиск значений с использованием функций INDEX (ИНДЕКС) и MATCH (ПОИСКПОЗ) и выпадающего списка
  9. Пример 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 в Excel - 1

Для того, чтобы найти результаты экзамена по физике для Андрея нам нужна формула:

=INDEX($B$3:$E$9,3,2) — английская версия

=ИНДЕКС($B$3:$E$9;3;2) — русская версия

В формуле мы определили аргумент диапазона данных, где мы будем искать данные $B$3:$E$9. Затем, указали номер строки “3”, в которой находятся результаты экзамена для Андрея, и номер колонки “2”, где находятся результаты экзамена именно по физике.

Пример 2. Создаем динамический поиск значений с использованием функций ИНДЕКС и ПОИСКПОЗ

Не всегда есть возможность указать номера строки и столбца вручную. У вас может быть огромная таблица данных, отображение данных которой вы можете сделать динамическим, чтобы функция автоматически идентифицировала имя или экзамен, указанные в ячейках, и дала правильный результат.

Пример динамического отображения данных ниже:

Функция INDEX в EXCEL - 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 Logo Больше лайфхаков в нашем Telegram Подписаться

Пример 3. Создаем динамический поиск значений с использованием функций INDEX (ИНДЕКС) и MATCH (ПОИСКПОЗ) и выпадающего списка

На примере выше мы вручную вводили имена студентов и названия предметов. Вы можете сэкономить время на вводе данных, используя выпадающие списки. Это актуально, когда количество данных огромное.

Используя выпадающие списки, вам нужно просто выбрать из списка имя студента и функция автоматически найдет и подставит необходимые данные.

Пример ниже:

Функция Excel Index - 3

Используя такой подход, вы можете создать удобный дашборд, например для учителя. Ему не придется заниматься фильтрацией данных или прокруткой листа со студентами, для того чтобы найти результаты экзамена конкретного студента, достаточно просто выбрать имя и результаты динамически отразятся в лаконичной и удобной форме.

Для того, чтобы осуществить динамическую подстановку данных с использованием функций 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 (ИНДЕКС) может быть использована для обработки трехсторонних запросов.

Что такое трехсторонний поиск?

В приведенных выше примерах мы использовали одну таблицу с оценками для студентов по разным предметам. Это пример двунаправленного поиска, поскольку мы используем две переменные для получения оценки (имя студента и предмет).

Теперь предположим, что к концу года студент прошел три уровня экзаменов: «Вступительный», «Полугодовой» и «Итоговый экзамен».

Трехсторонний поиск — это возможность получить отметки студента по заданному предмету с указанным уровнем экзамена.

Вот пример трехстороннего поиска:

Excel Index - 4

В приведенном выше примере, кроме выбора имени студента и названия предмета, вы также можете выбрать уровень экзамена. Основываясь на уровне экзамена, формула возвращает соответствующее значение из одной из трех таблиц.

Для таких расчетов нам поможет формула:

=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!

Excel INDEX Function (Examples + Video)

Excel INDEX Function

When to use Excel INDEX Function

Excel INDEX function can be used when you want to fetch the value from a tabular data and you have the row number and column number of the data point. For example, in the example below, you can use the INDEX function to get the marks of ‘Tom’ in Physics when you know the row number and the column number in the data set.

Excel INDEX Funtion - Example 1

What it Returns

It returns the value from a table for the specified row number and column number.

Syntax

=INDEX (array, row_num, [col_num])
=INDEX (array, row_num, [col_num], [area_num])

INDEX function has 2 syntax. The first one is used in most cases, however, in case of three-way lookups, the second one is used (covered in Example 5).

Input Arguments

  • array – a range of cells or an array constant.
  • row_num – the row number from which the value is to be fetched.
  • [col_num] – the column number from which the value is to be fetched. Although this is an optional argument, but if row_num is not provided, it needs to be given.
  • [area_num] – (Optional) If array argument is made up of multiple ranges, this number would be used to select the reference from all the ranges.

Additional Notes (Boring Stuff.. But Important to Know)

  • If the row number or the column number is 0, it returns the values of the entire row or column respectively.
  • If INDEX function is used in front of a cell reference (such as A1:) it returns a cell reference instead of a value (see examples below).
  • Most widely used along with the MATCH function.
  • Unlike VLOOKUP, INDEX function can return a value from the left of the lookup value.
  • INDEX function have two forms – Array form and the Reference form
    • ‘Array form’ is where you fetch a value based on row and column number from a given table.
    • ‘Reference form’ is where there are multiple tables, and you use the area_num argument to select the table and then fetch a value within it using the row and column number (see live example below).

Excel INDEX Function – Examples

Here are six examples of using Excel INDEX Function.

Example 1 – Finding Tom’s Marks in Physics (a two-way lookup)

Suppose you have a dataset as shown below:

Excel INDEX Funtion - Example 1

To find Tom’s marks in Physics, use the below formula:

=INDEX($B$3:$E$10,3,2)

This INDEX formula specifies the array as $B$3:$E$10 which has the marks for all the subjects. Then it uses the row number (3) and column number (2) to fetch Tom’s marks in Physics.

Example 2 – Making the LOOKUP Value Dynamic using MATCH Function

It may not always be possible to specify the row number and the column number manually. You may have a huge data set, or you may want to make it dynamic so that it automatically identifies the name and/or subject specified in cells and give the correct result.

Something as shown below:

Excel INDEX Function - Example 2 - Dynamic

This can be done using a combination of the INDEX and the MATCH function.

Here is the formula that will make the lookup values dynamic:

=INDEX($B$3:$E$10,MATCH($G$5,$A$3:$A$10,0),MATCH($H$4,$B$2:$E$2,0))

In the above formula, instead of hard-coding the row number and the column number, MATCH function is used to make it dynamic.

  • Dynamic Row Number is given by the following part of the formula – MATCH($G$5,$A$3:$A$10,0). It scans the name of students and identifies the lookup value ($G$5 in this case). It then returns the row number of the lookup value in the dataset. For example, if the lookup value is Matt, it’ll return 1, if it is Bob, it’ll return 2 and so on.
  • Dynamic Column Number is given by the following part of the formula – MATCH($H$4,$B$2:$E$2,0). It scans the subject names and identifies the lookup value ($H$4 in this case). It then returns the column number of the lookup value in the dataset. For example, if the lookup value is Math, it’ll return 1, if it is Physics, it’ll return 2 and so on.

Example 3 – Using Drop Down Lists as Lookup Values

In the above example, we have to manually enter the data. That could be time-consuming and error-prone, especially if you have a huge list of lookup values.

A good idea in such cases is to create a drop down list of the lookup values (in this case, it could be student names and subjects) and then simply choose from the list. Based on the selection, the formula would automatically update the result.

Something as shown below:

Excel INDEX Function - Example 3 - Dynamic Drop Downs

This makes a good dashboard component as you can have a huge data set with hundreds of students at the back end, but the end user (let’s say a teacher) can quickly get the marks of a student in a subject by simply making the selections from the drop down.

How to make this:

The formula used in this case is the same used in Example 2.

=INDEX($B$3:$E$10,MATCH($G$5,$A$3:$A$10,0),MATCH($H$4,$B$2:$E$2,0))

The lookup values have been converted into drop-down lists.

Here are the steps to create the Excel drop down list:

  • Select the cell in which you want the drop-down list. In this example, in G4, we want the student names.
  • Go to Data –> Data Tools –> Data Validation.
  • In the Data Validation Dialogue box, within the settings tab, select List from the Allow drop-down.
  • In the source, select $A$3:$A$10
  • Click OK.

Now you’ll have the drop-down list in cell G5. Similarly, you can create one in H4 for the subjects.

Example 4 – Return Values from an Entire Row/Column

In the above examples, we’ve used Excel INDEX function to do a 2-way lookup and get a single value.

Now, what if you want to get all the marks of a student. This can enable you to find the maximum/minimum score of that student, or the total marks scored in all subjects.

In simple English, you want to first get the entire row of scores for a student (let’s say Bob) and then within those values identify the highest score or the total of all the scores.

Here is the trick.

In Excel INDEX Function, when you enter the column number as 0, it will return the values of that entire row.

So the formula for this would be:

=INDEX($B$3:$E$10,MATCH($G$5,$A$3:$A$10,0),0)

Now this formula. if used as is, would return the #VALUE! error. While it displays the error, in the backend, it returns an array that has all the scores for Tom – {57,77,91,91}.

If you select the formula in the edit mode and press F9, you’ll be able to see the array it returns (as shown below): Excel INDEX Function - Example 4 Entire Row

Similarly, based on what the lookup value is, when the column number is specified as 0 (or is left blank), it returns all the values in the row for the lookup value

Now to calculate the total score obtained by Tom, we can simply use the above formula within the SUM function.

=SUM(INDEX($B$3:$E$10,MATCH($G$5,$A$3:$A$10,0),0))

On similar lines, to calculate the highest score, we can use MAX/LARGE and to calculate minimum, we can use MIN/SMALL.

Excel INDEX Function - Example 4 Entire Row Highest SUM

Example 5 – Three Way Lookup Using INDEX/MATCH

Excel INDEX function is built to handle three-way lookups.

What is a three-way lookup?

In the above examples, we’ve used one table with scores for students in different subjects. This is an example of a two-way lookup as we use two variables to fetch the score (student’s name and the subject).

Now, suppose in a year, a student has three different levels of exams, Unit Test, Midterm, and Final Examination (that’s what I had when I was a student).

A three-way lookup would be the ability to get a student’s marks for a specified subject from the specified level of exam. This would make it a three-way lookup as there are three variables (student’s name, subject’s name, and the level of examination).

Here is an example of a three-way lookup:

Excel INDEX Function - Example 5 - Three Way Lookup

In the example above, apart from selecting the student’s name and subject name, you can also select the level of exam. Based on the level of exam, it returns the matching value from one of the three tables.

Here is the formula used in cell H4:

=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="Unit Test",1,IF($H$2="Midterm",2,3)))

Let’s break down this formula to understand how it works.

This formula takes four arguments. INDEX is one of those functions in Excel that has more than one syntax.

=INDEX (array, row_num, [col_num])
=INDEX (array, row_num, [col_num], [area_num])

So far in all the example above, we have used the first syntax, but to do a three-way lookup, we need to use the second syntax.

Now let’s see each part of the formula based on the second syntax.

  • array – ($B$3:$E$7,$B$11:$E$15,$B$19:$E$23): Instead of using a single array, in this case, we have used three arrays within parenthesis.
  • row_num – MATCH($G$4,$A$3:$A$7,0): MATCH function is used to find the position of the student’s name in cell $G$4 in the list of student’s name.
  • col_num – MATCH($H$3,$B$2:$E$2,0): MATCH function is used to find the position of the subject name in cell $H$3 in the list of subject’s name.
  • [area_num] – IF($H$2=”Unit Test”,1,IF($H$2=”Midterm”,2,3)): The area number value tells the INDEX function which array to select. In this example, we have three arrays in the first argument. If you select Unit Test from the drop-down, the IF function returns 1 and the INDEX functions select 1st array from the three arrays (which is $B$3:$E$7).

Example 6 – Creating a Reference Using the INDEX Function (Dynamic Named Ranges)

This is one wild use of the Excel INDEX function.

Let’s take a simple example.

I have a list of names as shown below:

Excel Index Function - Example 6 - Reference

Now I can use a simple INDEX function to get the last name on the list.

Here is the formula:

=INDEX($A$2:$A$9,COUNTA($A$2:$A$9))

This function simply counts the number of cells that are not empty and returns the last item from this list (it works only when there are no blanks in the list).Excel INDEX Function - Reference 2

Now, what here comes the magic.

If you put the formula in front of a cell reference, the formula would return a cell reference of the matching value (instead of the value itself).

=A2:INDEX($A$2:$A$9,COUNTA($A$2:$A$9))

You would expect the above formula to return =A2:”Josh” (where Josh is the last value in the list). However, it returns =A2:A9 and hence you get an array of names as shown below:Excel INDEX Functions - References 3

One practical example where this technique can be helpful is in creating dynamic named ranges.

That’s it in this tutorial. I’ve tried to cover major examples of using the Excel INDEX function. If you would like to see more examples added to this list, let me know in the comments section.

Note: I’ve tried my best to proof read this tutorial, but in case you find any errors or spelling mistakes, please let me know 🙂

Excel INDEX Function – Video Tutorial

Related Excel Functions:

  • Excel VLOOKUP Function.
  • Excel HLOOKUP Function.
  • Excel INDIRECT Function.
  • Excel MATCH Function.
  • Excel OFFSET Function.

You May Also Like the Following Excel Tutorials:

  • VLOOKUP Vs. INDEX/MATCH
  • Excel Index Match
  • Lookup and Return Values in an Entire Row/Column.

Содержание

  1. INDEX function
  2. Array form
  3. Description
  4. Syntax
  5. Remarks
  6. Examples
  7. Example 1
  8. Example 2
  9. Reference form
  10. Description
  11. Syntax
  12. Remarks
  13. Examples
  14. ИНДЕКС (функция ИНДЕКС)
  15. Форма массива
  16. Описание
  17. Синтаксис
  18. Замечания
  19. Примеры
  20. Пример 1
  21. Пример 2
  22. Справочная форма
  23. Описание
  24. Синтаксис
  25. Замечания
  26. Примеры
  27. Функция INDEX (ИНДЕКС) в Excel. Как использовать?
  28. Что возвращает функция
  29. Синтаксис
  30. Аргументы функции
  31. Дополнительная информация
  32. Примеры использования функции ИНДЕКС в Excel
  33. Пример 1. Ищем результаты экзамена по физике для Алексея
  34. Пример 2. Создаем динамический поиск значений с использованием функций ИНДЕКС и ПОИСКПОЗ
  35. Пример 3. Создаем динамический поиск значений с использованием функций INDEX (ИНДЕКС) и MATCH (ПОИСКПОЗ) и выпадающего списка
  36. Пример 4. Использование трехстороннего поиска с помощью INDEX (ИНДЕКС) / MATCH (ПОИСКПОЗ)

INDEX function

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.

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.

Value at the intersection of the second row and second column in the range A2:B3.

Value at the intersection of the second row and first column in the range A2:B3.

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.

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.

Value found in the second row, second column in the array (same array as above).

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.

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.

Источник

ИНДЕКС (функция ИНДЕКС)

Функция ИНДЕКС возвращает значение или ссылку на значение из таблицы или диапазона.

Функцию ИНДЕКС можно использовать двумя способами:

Если вы хотите возвращать значение указанной ячейки или массива ячеек, см. раздел Форма массива.

Если требуется возвращать ссылку на указанные ячейки, см. раздел Ссылочная форма.

Форма массива

Описание

Возвращает значение элемента в таблице или массиве, выбранное по индексам номеров строк и столбцов.

Если первый аргумент функции ИНДЕКС является константной массива, используйте форму массива.

Синтаксис

ИНДЕКС(массив; номер_строки; [номер_столбца])

Форма массива функции INDEX имеет следующие аргументы:

массив. Обязательный аргумент. Диапазон ячеек или константа массива.

Если массив содержит только одну строку или столбец, соответствующий аргумент номер_строки или номер_столбца является необязательным.

Если массив содержит более одной строки и более одного столбца и используется только номер_строки или номер_столбца, ИНДЕКС возвращает массив всей строки или столбца в массиве.

Номер_строки Обязательный, если column_num отсутствует. Выбирает строку в массиве, из которой требуется возвратить значение. Если номер_строки опущен, требуется номер_столбца.

Номер_столбца — необязательный аргумент. Выбирает столбец в массиве, из которого требуется возвратить значение. Если номер_столбца опущен, требуется номер_строки.

Замечания

Если используются аргументы номер_строки и номер_столбца, функция ИНДЕКС возвращает значение в ячейке на пересечении номеров_строки и номера_столбца.

row_num и column_num должны указывать на ячейку в массиве; в противном случае ИНДЕКС возвращает #ССЫЛКА! ошибку «#ЗНАЧ!».

Если задать для row_num или column_num значение 0 (ноль), ИНДЕКС возвращает массив значений для всего столбца или строки соответственно. Чтобы использовать значения, возвращаемые в виде массива, введите функцию ИНДЕКС как формулу массива.

Примечание: Если у вас есть текущая версия Microsoft 365, вы можете ввести формулу в верхнюю левую ячейку выходного диапазона, а затем нажать клавишу ВВОД, чтобы подтвердить формулу как формулу динамического массива. В противном случае формулу необходимо ввести как устаревшую формулу массива, сначала выбрав выходной диапазон, введите формулу в верхнюю левую ячейку выходного диапазона, а затем нажмите CTRL+SHIFT+ENTER для подтверждения. Excel автоматически вставляет фигурные скобки в начале и конце формулы. Дополнительные сведения о формулах массива см. в статье Использование формул массива: рекомендации и примеры.

Примеры

Пример 1

В этих примерах функция ИНДЕКС используется для поиска значения ячейки, находящейся на пересечении заданных строки и столбца.

Скопируйте образец данных из следующей таблицы и вставьте их в ячейку A1 нового листа Excel. Чтобы отобразить результаты формул, выделите их и нажмите клавишу F2, а затем — ВВОД.

Значение ячейки на пересечении второй строки и второго столбца в диапазоне A2:B3.

Значение ячейки на пересечении второй строки и первого столбца в диапазоне A2:B3.

Пример 2

В этом примере функция ИНДЕКС используется в формуле массива для поиска значений двух заданных ячеек в массиве с диапазоном 2 x 2.

Примечание: Если у вас есть текущая версия Microsoft 365, вы можете ввести формулу в верхнюю левую ячейку выходного диапазона, а затем нажать клавишу ВВОД, чтобы подтвердить формулу как формулу динамического массива. В противном случае формулу необходимо ввести как устаревшую формулу массива, сначала выбрав две пустые ячейки, введите формулу в верхнюю левую ячейку выходного диапазона, а затем нажмите CTRL+SHIFT+ENTER для подтверждения. Excel автоматически вставляет фигурные скобки в начале и конце формулы. Дополнительные сведения о формулах массива см. в статье Использование формул массива: рекомендации и примеры.

Значение ячейки на пересечении первой строки и второго столбца в массиве. Массив содержит значения 1 и 2 в первой строке и значения 3 и 4 во второй строке.

Значение ячейки на пересечении второй строки и второго столбца в массиве, указанном выше.

Справочная форма

Описание

Возвращает ссылку на ячейку, расположенную на пересечении указанной строки и указанного столбца. Если ссылка состоит из несмежных выборок, вы можете выбрать выборку для поиска.

Синтаксис

ИНДЕКС(ссылка; номер_строки; [номер_столбца]; [номер_области])

Справочная форма функции ИНДЕКС имеет следующие аргументы:

ссылка — обязательный аргумент. Ссылка на один или несколько диапазонов ячеек.

Если вы вводите несмежный диапазон для ссылки, заключите ссылку в круглые скобки.

Если каждая область в ссылке содержит только одну строку или столбец, аргумент номер_строки или номер_столбца соответственно является необязательным. Например, для ссылки на единственную строку нужно использовать формулу ИНДЕКС(ссылка,,номер_столбца).

Номер_строки Обязательный аргумент. Номер строки в диапазоне, заданном аргументом «ссылка», из которого требуется возвратить ссылку.

Номер_столбца — необязательный аргумент. Номер столбца в диапазоне, заданном аргументом «ссылка», из которого требуется возвратить ссылку.

area_num Необязательный. Выбирает диапазон в ссылке, из которого возвращается пересечение row_num и column_num. Первая выбранная или введенная область имеет номер 1, вторая — 2 и так далее. Если номер_области опущен, ИНДЕКС использует область 1. Перечисленные здесь области должны располагаться на одном листе. Если вы укажете области, которые не находятся на одном листе друг с другом, это вызовет ошибку #ЗНАЧ! ошибку «#ВЫЧИС!». Если вам нужно использовать диапазоны, расположенные на разных листах друг от друга, рекомендуется использовать форму массива функции ИНДЕКС, а для вычисления диапазона, из которого состоит массив, использовать другую функцию. Например, вы можете использовать функцию ВЫБОР, чтобы вычислить, какой диапазон будет использоваться.

Например, если ссылка описывает ячейки (A1:B4,D1:E4,G1:H4), номер_области 1 – это диапазон A1:B4, номер_области 2 – это диапазон D1:E4, а номер_области 3 – диапазон G1:H4.

Замечания

После того, как ссылка и area_num выбрали конкретный диапазон, row_num и column_num выбирают конкретную ячейку: row_num 1 — это первая строка в диапазоне, column_num 1 — это первый столбец и так далее. Ссылка, возвращаемая INDEX, представляет собой пересечение row_num и column_num.

Если вы установите номер_строки или номер_столбца равным 0 (ноль), ИНДЕКС возвращает ссылку для всего столбца или строки соответственно.

row_num, column_num и area_num должны указывать на ячейку в пределах ссылки; в противном случае ИНДЕКС возвращает #ССЫЛКА! ошибку «#ЗНАЧ!». Если номер_строки и номер_столбца опущены, ИНДЕКС возвращает область в ссылке, указанную номером_области.

Результатом вычисления функции ИНДЕКС является ссылка, которая интерпретируется в качестве таковой другими функциями. В зависимости от формулы значение, возвращаемое функцией ИНДЕКС, может использоваться как ссылка или как значение. Например, формула ЯЧЕЙКА(«ширина»;ИНДЕКС(A1:B2;1;2)) эквивалентна формуле ЯЧЕЙКА(«ширина»;B1). Функция ЯЧЕЙКА использует значение, возвращаемое функцией ИНДЕКС, как ссылку. С другой стороны, такая формула, как 2*ИНДЕКС(A1:B2;1;2), преобразует значение, возвращаемое функцией ИНДЕКС, в число в ячейке B1.

Примеры

Скопируйте образец данных из следующей таблицы и вставьте их в ячейку A1 нового листа Excel. Чтобы отобразить результаты формул, выделите их и нажмите клавишу F2, а затем — клавишу Enter.

Источник

Функция INDEX (ИНДЕКС) в Excel. Как использовать?

Функция INDEX (ИНДЕКС) в Excel используется для получения данных из таблицы, при условии что вы знаете номер строки и столбца, в котором эти данные находятся.

Например, в таблице ниже, вы можете использовать эту функцию для того, чтобы получить результаты экзамена по Физике у Андрея, зная номер строки и столбца, в которых эти данные находятся.

Что возвращает функция

Возвращает данные из конкретной строки и столбца табличных данных.

Синтаксис

=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” и так далее.

Пример 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!

Источник

The INDEX function returns the value at a given location in a range or array. INDEX is a powerful and versatile function. You can use INDEX to retrieve individual values, or entire rows and columns. INDEX is frequently used together with the MATCH function. In this scenario, the MATCH function locates and feeds a position to the INDEX function, and INDEX returns the value at that position. 

In the most common usage, INDEX takes three arguments: array, row_num, and col_num. Array is the range or array from which to retrieve values. Row_num is the row number from which to retrieve a value, and col_num is the column number at which to retrieve a value. Col_num is optional and not needed when array is one-dimensional.

In the example shown above, the goal is to get the diameter of the planet Jupiter. Because Jupiter is the fifth planet in the list, and Diameter is the third column, the formula in G7 is:

=INDEX(B5:E13,5,3) // diameter of Jupiter

The formula above is of limited value because the row number and column number have been hard-coded. Typically, the MATCH function would be used inside INDEX to provide these numbers. For a detailed explanation with many examples, see: How to use INDEX and MATCH.

Basic usage

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. For example, to get the third item from the one-dimensional range A1:A5:

=INDEX(A1:A5,3) // returns value in A3

The formulas below show how INDEX can be used to get a value from a two-dimensional range:

=INDEX(A1:B5,2,2) // returns value in B2
=INDEX(A1:B5,3,1) // returns value in A3

INDEX and MATCH

In the examples above, the position is «hardcoded». Typically, the MATCH function is used to find positions for INDEX. For example, in the screen below, the MATCH function is used to locate «Mars» (G6) in row 3 and feed that position to INDEX. The formula in G7 is:

=INDEX(B5:E13,MATCH(G6,B5:B13,0),3)

Example of INDEX and MATCH formula

MATCH provides the row number (4) to INDEX. The column number is still hardcoded as 3.

INDEX and MATCH with horizontal table

In the screen below, the table above has been transposed horizontally. The MATCH function returns the column number (4) and the row number is hardcoded as 2. The formula in C10 is:

=INDEX(C4:K6,2,MATCH(C9,C4:K4,0))

Example of INDEX and MATCH formula with horizontal table

For a detailed explanation with many examples, see: How to use INDEX and MATCH

Entire row / column

INDEX can be used to return entire columns or rows like this:

=INDEX(range,0,n) // entire column
=INDEX(range,n,0) // entire row

where n represents the number of the column or row to return. This example shows a practical application of this idea.

Reference as result

It’s important to note that the INDEX function returns a reference as a result. For example, in the following formula, INDEX returns A2:

=INDEX(A1:A5,2) // returns A2

In a typical formula, you’ll see the value in cell A2 as the result, so it’s not obvious that INDEX is returning a reference. However, this is a useful feature in formulas like this one, which uses INDEX to create a dynamic named range. You can use the CELL function to report the reference returned by INDEX.

Two forms

The INDEX function has two forms: array and reference. Both forms have the same behavior – INDEX returns a reference in an array based on a given row and column location. The difference is that the reference form of INDEX allows more than one array, along with an optional argument to select which array should be used. Most formulas use the array form of INDEX, but both forms are discussed below. 

Array form

In the array form of INDEX, the first parameter is an array, which is supplied as a range of cells or an array constant. The syntax for the array form of INDEX is:

INDEX(array,row_num,[col_num])
  • If both row_num and col_num are supplied, INDEX returns the value in the cell at the intersection of row_num and col_num.
  • If row_num is set to zero, INDEX returns an array of values for an entire column. To use these array values, you can enter the INDEX function as an array formula in horizontal range, or feed the array into another function.
  • If col_num is set to zero, INDEX returns an array of values for an entire row. To use these array values, you can enter the INDEX function as an array formula in vertical range, or feed the array into another function.

Reference form

In the reference form of INDEX, the first parameter is a reference to one or more ranges, and a fourth optional argument, area_num, is provided to select the appropriate range. The syntax for the reference form of INDEX is:

INDEX(reference,row_num,[col_num],[area_num])

Just like the array form of INDEX, the reference form of INDEX returns the reference of the cell at the intersection row_num and col_num. The difference is that the reference argument contains more than one range, and area_num selects which range should be used. The area_num is argument is supplied as a number that acts like a numeric index. The first array inside reference is 1, the second array is 2, and so on.

For example, in the formula below, area_num is supplied as 2, which refers to the range A7:C10:

=INDEX((A1:C5,A7:C10),1,3,2)

In the above formula, INDEX will return the value at row 1 and column 3 of A7:C10.

  • Multiple ranges in reference are separated by commas and enclosed in parentheses.
  • All ranges must on one sheet or INDEX will return a #VALUE error. Use the CHOOSE function as a workaround.

Понравилась статья? Поделить с друзьями:
  • Data from web page to excel
  • Data from pdf to excel
  • Data from html to excel
  • Data from form to excel
  • Data from excel to labels