Функция match в excel
5 вариантов использования функции ИНДЕКС (INDEX)
Бывает у вас такое: смотришь на человека и думаешь «что за @#$%)(*?» А потом при близком знакомстве оказывается, что он знает пять языков, прыгает с парашютом, имеет семеро детей и черный пояс в шахматах, да и, вообще, добрейшей души человек и умница?
Так и в Microsoft Excel: есть несколько похожих функций, про которых фраза «внешность обманчива» работает на 100%. Одна из наиболее многогранных и полезных — функция ИНДЕКС (INDEX) . Далеко не все пользователи Excel про нее знают, и еще меньше используют все её возможности. Давайте разберем варианты ее применения, ибо их аж целых пять.
Вариант 1. Извлечение данных из столбца по номеру ячейки
Самый простой случай использования функции ИНДЕКС – это ситуация, когда нам нужно извлечь данные из одномерного диапазона-столбца, если мы знаем порядковый номер ячейки. Синтаксис в этом случае будет:
=ИНДЕКС( Диапазон_столбец ; Порядковый_номер_ячейки )
Этот вариант известен большинству продвинутых пользователей Excel. В таком виде функция ИНДЕКС часто используется в связке с функцией ПОИСКПОЗ (MATCH) , которая выдает номер искомого значения в диапазоне. Таким образом, эта пара заменяет легендарную ВПР (VLOOKUP) :
. но, в отличие от ВПР, могут извлекать значения левее поискового столбца и номер столбца-результата высчитывать не нужно.
Вариант 2. Извлечение данных из двумерного диапазона
Если диапазон двумерный, т.е. состоит из нескольких строк и столбцов, то наша функция будет использоваться немного в другом формате:
=ИНДЕКС( Диапазон ; Номер_строки ; Номер_столбца )
Т.е. функция извлекает значение из ячейки диапазона с пересечения строки и столбца с заданными номерами.
Легко сообразить, что с помощью такой вариации ИНДЕКС и двух функций ПОИСКПОЗ можно легко реализовать двумерный поиск:
Вариант 3. Несколько таблиц
Если таблица не одна, а их несколько, то функция ИНДЕКС может извлечь данные из нужной строки и столбца именно заданной таблицы. В этом случае используется следующий синтаксис:
=ИНДЕКС( (Диапазон1;Диапазон2;Диапазон3) ; Номер_строки ; Номер_столбца ; Номер_диапазона )
Обратите особое внимание, что в этом случае первый аргумент – список диапазонов — заключается в скобки, а сами диапазоны перечисляются через точку с запятой.
Вариант 4. Ссылка на столбец / строку
Если во втором варианте использования функции ИНДЕКС номер строки или столбца задать равным нулю (или просто не указать), то функция будет выдавать уже не значение, а ссылку на диапазон-столбец или диапазон-строку соответственно:
Обратите внимание, что поскольку ИНДЕКС выдает в этом варианте не конкретное значение ячейки, а ссылку на диапазон, то для подсчета потребуется заключить ее в дополнительную функцию, например СУММ (SUM) , СРЗНАЧ (AVERAGE) и т.п.
Вариант 5. Ссылка на ячейку
Общеизвестно, что стандартная ссылка на любой диапазон ячеек в Excel выглядит как Начало-Двоеточие-Конец, например A2:B5. Хитрость в том, что если взять функцию ИНДЕКС в первом или втором варианте и подставить ее после двоеточия, то наша функция будет выдавать уже не значение, а адрес, и на выходе мы получим полноценную ссылку на диапазон от начальной ячейки до той, которую нашла ИНДЕКС:
Нечто похожее можно реализовать функцией СМЕЩ (OFFSET) , но она, в отличие от ИНДЕКС, является волатильной, т.е. пересчитывается каждый раз при изменении любой ячейки листа. ИНДЕКС же работает более тонко и запускает пересчет только при изменении своих аргументов, что ощутимо ускоряет расчет в тяжелых книгах по сравнению со СМЕЩ.
Один из весьма распространенных на практике сценариев применения ИНДЕКС в таком варианте — это сочетание с функцией СЧЁТЗ (COUNTA) , чтобы получить автоматически растягивающиеся диапазоны для выпадающих списков, сводных таблиц и т.д.
30 функций Excel за 30 дней: ПОИСКПОЗ (MATCH)
Вчера в марафоне 30 функций Excel за 30 дней мы находили текстовые строки при помощи функции SEARCH (ПОИСК), а также использовали IFERROR (ЕСЛИОШИБКА) и ISNUMBER (ЕЧИСЛО) в ситуациях, когда функция выдаёт ошибку.
В 19-й день нашего марафона мы займёмся изучением функции MATCH (ПОИСКПОЗ). Она ищет значение в массиве и, если значение найдено, возвращает его позицию.
Итак, давайте обратимся к справочной информации по функции MATCH (ПОИСКПОЗ) и разберем несколько примеров. Если у Вас есть собственные примеры или подходы по работе с этой функцией, пожалуйста, делитесь ими в комментариях.
Функция 19: MATCH (ПОИСКПОЗ)
Функция MATCH (ПОИСКПОЗ) возвращает позицию значения в массиве или ошибку #N/A (#Н/Д), если оно не найдено. Массив может быть, как сортированный, так и не сортированный. Функция MATCH (ПОИСКПОЗ) не чувствительна к регистру.
Как можно использовать функцию MATCH (ПОИСКПОЗ)?
Функция MATCH (ПОИСКПОЗ) возвращает позицию элемента в массиве, и этот результат может быть использован другими функциями, такими как INDEX (ИНДЕКС) или VLOOKUP (ВПР). Например:
- Найти положение элемента в несортированном списке.
- Использовать вместе с CHOOSE (ВЫБОР), чтобы перевести успеваемость учащихся в буквенную систему оценок.
- Использовать вместе с VLOOKUP (ВПР) для гибкого выбора столбца.
- Использовать вместе с INDEX (ИНДЕКС), чтобы найти ближайшее значение.
Синтаксис MATCH (ПОИСКПОЗ)
Функция MATCH (ПОИСКПОЗ) имеет следующий синтаксис:
MATCH(lookup_value,lookup_array,[match_type])
ПОИСКПОЗ(искомое_значение;просматриваемый_массив;[тип_сопоставления])
- lookup_value (искомое_значение) – может быть текстом, числом или логическим значением.
- lookup_array (просматриваемый_массив) – массив или ссылка на массив (смежные ячейки в одном столбце или в одной строке).
- match_type (тип_сопоставления) – может принимать три значения: -1, или 1. Если аргумент пропущен, это равносильно 1.
Ловушки MATCH (ПОИСКПОЗ)
Функция MATCH (ПОИСКПОЗ) возвращает положение найденного элемента, но не его значение. Если требуется вернуть значение, используйте MATCH (ПОИСКПОЗ) вместе с функцией INDEX (ИНДЕКС).
Пример 1: Находим элемент в несортированном списке
Для несортированного списка можно использовать в качестве значения аргумента match_type (тип_сопоставления), чтобы выполнить поиск точного совпадения. Если требуется найти точное совпадение текстовой строки, то в искомом значении допускается использовать символы подстановки.
В следующем примере, чтобы найти положение месяца в списке, мы можем написать название месяца либо целиком, либо частично с применением символов подстановки.
В качестве аргумента lookup_array (просматриваемый_массив) можно использовать массив констант. В следующем примере искомый месяц введен в ячейку D5, а названия месяцев подставлены в качестве второго аргумента функции MATCH (ПОИСКПОЗ) в виде массива констант. Если в ячейке D5 ввести более поздний месяц, например, Oct (октябрь), то результатом функции будет #N/A (#Н/Д).
Пример 2: Изменяем оценки учащихся c процентов на буквы
Вы можете преобразовать оценки учащихся в буквенную систему, используя функцию MATCH (ПОИСКПОЗ) так же, как Вы делали это с VLOOKUP (ВПР). В этом примере функция использована в сочетании с CHOOSE (ВЫБОР), которая и возвращает нужную нам оценку. Аргумент match_type (тип_сопоставления) принимаем равным -1, поскольку баллы в таблице отсортированы в порядке убывания.
Когда аргумент match_type (тип_сопоставления) равен -1, результатом будет наименьшее значение, которое больше искомого или эквивалентное ему. В нашем примере искомое значение равно 54. Поскольку такого значения нет в списке баллов, то возвращается элемент, соответствующий значению 60. Так как 60 стоит на четвёртом месте списка, то результатом функции CHOOSE (ВЫБОР) будет значение, которое находится на 4-й позиции, т.е. ячейка C6, в которой находится оценка D.
Пример 3: Создаем гибкий выбор столбца для VLOOKUP (ВПР)
Чтобы придать больше гибкости функции VLOOKUP (ВПР), Вы можете использовать MATCH (ПОИСКПОЗ) для поиска номера столбца, а не жестко вписывать его значение в функцию. В следующем примере пользователи могут выбрать регион в ячейке H1, это искомое значение для VLOOKUP (ВПР). Далее, они могут выбрать месяц в ячейке H2, и функция MATCH (ПОИСКПОЗ) возвратит номер столбца, соответствующий этому месяцу.
Пример 4: Находим ближайшее значение при помощи INDEX (ИНДЕКС)
Функция MATCH (ПОИСКПОЗ) отлично работает в сочетании с функцией INDEX (ИНДЕКС), которую мы рассмотрим более пристально чуть позже в рамках данного марафона. В этом примере функция MATCH (ПОИСКПОЗ) использована для того, чтобы найти из нескольких угаданных чисел ближайшее к правильному.
- Функция ABS возвращает модуль разницы между каждым угаданным и правильным числами.
- Функция MIN (МИН) находит наименьшую из разниц.
- Функция MATCH (ПОИСКПОЗ) находит адрес наименьшей разницы в списке разниц. Если в списке есть несколько совпадающих значений, то возвращено будет первое.
- Функция INDEX (ИНДЕКС) возвращает имя, соответствующее этой позиции, из списка имен.
How to use INDEX and MATCH
Introduction
Apart from VLOOKUP, INDEX and MATCH is the most widely used tool in Excel for performing lookups. The INDEX and MATCH combo is potent and flexible, and you’ll see it used in all kinds of formulas, from basic to very advanced.
However, while VLOOKUP allows you to perform lookups with a single function, INDEX and MATCH requires two functions, one nested inside another. Many users find this confusing, because they aren’t used to combining functions in Excel, so they avoid INDEX and MATCH. That’s a shame. Combining functions is the key to more advanced formulas in Excel.
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.
INDEX – get value at known position
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 values at a given location in a list or table. 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 do it with this simple formula based on the INDEX function:
INDEX locates the 4th cell in B3:B11, B6, and returns the value at that address.
INDEX and 2D lookups
What if you want to get the diameter of Mars? In that case, we can give INDEX both a row number and a column number, and feed in a larger array (range) of data. The INDEX formula below uses the full range of data in B3:D11, with a row number of 4 and column number of 2:
How INDEX can be used to retrieve a value in a 2D table.
To summarize, INDEX gets a value at a specified 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.
MATCH – find position in a list
The MATCH function is designed for one purpose: find the numeric position of an item in a list. For example, we can use MATCH to get the position of the word «peach» in this list of fruits like this:
MATCH returns 3, since «Peach» is the third item in the range. Notice MATCH is not case-sensitive.
MATCH doesn’t care if the list is horizontal or vertical. If we arrange the list of fruits horizontally, we get the same result with this MATCH formula:
The MATCH function with a horizontal range. Same result, MATCH returns 3.
Match type – approximate or exact?
With the MATCH function, the first argument is the lookup value, the second is the lookup array, and the third argument is match type. Match type is important and controls whether matching is exact or approximate. The table below summarizes the options:
The bottom line?
For basic exact match lookups, you’ll want to specify zero, to force an exact match. However, if you need an approximate match to lookup values along a scale, you’ll want to use either 1 or -1, and you’ll need to sort the lookup array according to your needs, [A-Z] when match type is 1, [Z-A] when match type is -1.
Caution: Like VLOOKUP, the MATCH function defaults to an approximate match. Approximate matching is useful when you want to find the best match in a scale of values, but it can be a disaster when you need an exact match. I recommend always setting match type explicitly to avoid unwelcome surprises.
INDEX and MATCH together
Now that we’ve covered the basics of INDEX and MATCH, how can 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 any given salesperson. From the discussion above, we know we can give hardcoded values to INDEX to retrieve a value. For example, to return the February sales number for Frantz, this INDEX formula will do the job:
Here we ask INDEX for the value in row 5, column 2 from the range C3:E11, and INDEX returns $5,194.
But we obviously don’t want to hardcode values. Instead, we want a dynamic lookup.
Working one step at a time, let’s leave the column hardcoded as 2 and make the row number dynamic. How will we do that? The MATCH function of course! MATCH will work perfectly for finding the position of Frantz in the list of names. Here’s a revised formula, using the MATCH function, inside of INDEX. Notice we have replaced the number 5 with MATCH:
When MATCH finds «Frantz» in B3:B11, it returns the number 5 directly into INDEX:
Naturally, we don’t want to hardcode the name either. What we need is a way to input *any* name, then let INDEX and MATCH do their magic.
The screen below shows a very simple implementation of this idea. The formula in H3 is:
MATCH uses the name in H2 to find a row number for INDEX.
To summarize: INDEX wants numeric positions. MATCH finds those positions.
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 for any given salesperson. To keep things simple, we hardcoded the column number 2 to get sales for February. How can we make the formula fully dynamic, so we can 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 return the position of March, which is 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:
We now have a fully dynamic, two-way lookup with INDEX and MATCH, and the formula looks like this:
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:
and INDEX correctly returns $10,525, the sales number for Frantz in March.
Note: you could use Data Validation to create simple dropdown menus for both salesperson and month.
Video: How to debug a formula with F9 (to see MATCH return values)
More examples of INDEX + MATCH
Here are some other examples of INDEX and MATCH in action, each with a detailed explanation:
What about VLOOKUP?
Spoiler first: INDEX + MATCH can do everything VLOOKUP can do, and more. It’s simply a more flexible way to look things up. Here are a few advantages over VLOOKUP:
- INDEX and MATCH can look left or right in a table, VLOOKUP can only look right
- INDEX and MATCH can work with horizontal or vertical ranges, VLOOKUP can only use vertical ranges
- INDEX and MATCH can work with data sorted in descending order, VLOOKUP can only match data sorted in ascending order
- If you have a large set of data, INDEX and MATCH can be faster
However, there is no reason not to use VLOOKUP when the situation fits. It’s an excellent function with it’s own benefits:
- VLOOKUP is simple to configure, and requires just one function
- VLOOKUP is a great starting point for learning lookups in Excel
- VLOOKUP is easier for others to understand
- VLOOKUP is everywhere, so it’s a must-know function
Reasons you may want to use INDEX + MATCH instead of VLOOKUP:
- The lookup value is to the right of data you need to lookup
- The data range is horizontal, and not suitable for HLOOKUP
- Data is sorted in descending order
- The data set is very large, and performance is a factor
- You just like INDEX + MATCH 🙂
I generally default to VLOOKUP, and switch to INDEX + MATCH when needed.
To learn more about VLOOKUP, see this article: 23 things you should know about VLOOKUP.
Синтаксис функции Match
Есть формула — замена ВПР.
Написать формулу с применением функции Match ()
Используя расстояния между городами США, приведенные в таблице, напишите формулу с применением.
Интегрирование функции ошибка pattern match exception
Не интегрирует функцию, Что за ошибка pattern match exception?
Непонятен синтаксис определения функции (параметр функции — auto)
Моё казино с "auto", "->" и шаблонными функциями Думаю, неплохое озаглавие для этой темы. Ну.
Синтаксис функции
Есть функция Function Move_File(source, Destination) Set fso =.
Решение
shavka, F1 всё знает и делится своей мудростью со всеми, кто к нему обращается
а если серьёзно, то надеюсь, что Cells(3, 2) это только пример и в реальности номер строки/столбца переменные, так как в противном случае, Вы можете сразу написать & «,Match(B3,’Шаблон’!» &
pashulka, может, подскажете, в чем проблема? Столкнулся с таким парадоксом. Если пишу через формулу, все работает, а если через функцию — нифика. Как такое может быть? Опять синтаксис не тот (F1 со мной не разговаривает)? Такой код работает:
А вот такой — ругается:
Решение
WorksheetFunction относится только к INDEX , проще говоря, должно быть так :
где prihod и sum — переменные типа Range.
Пробовал также IIf. Везде пишет Type mismatch.
Если говорить предметно, то Ваша, формула хоть и использует неявное пересечение, но работает
Решение
Конечно, вышеупомянутая Evaluate
Однако, аналогичный результат можно получить и так :
Впрочем, и циклы это не всегда медленно :
Заказываю контрольные, курсовые, дипломные и любые другие студенческие работы здесь.
Синтаксис функции
Есть код который вытягивает с базы значения, они могут быть: 1. По скайпу 2. Локально 3. По.
Объясните синтаксис функции в С++
Допустим у меня есть код, суть которого состоит в нахождении корня, абсолютного модуля, косинуса.
Синтаксис функции в Basic
1.Синтаксис функции в Basic 2.Синтаксис процедуры 3.Объявление переменной, передаваемой по.
Синтаксис пользовательской функции массива.
Подскажите, пожалуйста, синтаксис пользовательской функции-массива? Где это находится в Help VBA.
Match Excel Function
Match function in excel is used to find a position of the reference cell in a given range of cells, the reference is a value which is searched from a range of cells, and the position is the first position which is found for the value, the method to use this formula is as follows =MATCH( Value to be searched, Table, and exact or approx. match <0 or 1>).
MATCH Function in Excel (Table of Contents)
MATCH in Excel
The Excel MATCH function is simple lookup function used in Excel. MATCH Function is used to find out the position of a lookup value in a lookup array (row, column, or table). MATCH function search the lookup_value in lookup_array for approximate and exact matching, and also supports (*&?) for partial matches values. Excel Match function often used with index formula to find the lookup value.
Basically, MATCH function returns a relative position of a lookup value in a range of cells. In simple words Excel MATCH function searches for a lookup_value in a lookup_array and provides the relative position of that lookup_value.
MATCH Formula in Excel
The MATCH Formula in excel is as follows
Recommended Courses
Explanation of MATCH Function in Excel
MATCH Formula in Excel has three parameter two (lookup_value,lookup_array) are compulsory parameters and one (match_type) is optional.
Compulsory Parameter:
- lookup_value: lookup value is value which you want to search in lookup array. Suppose you want to search a word in dictionary than that particular word will be your lookup value and dictionary will be your lookup array.
- lookup_array: lookup_array is the set of data where the lookup value is located and your search applied in lookup array.
Optional Parameter:
- [match_type]::match_type is limited to -1, 0, or 1, depending on the type of ‘MATCH’.
- It will be 0 for the first exact match lookup value.
- 1 for the largest value or = toour ‘lookup_value’.
How to use MATCH Function in Excel?
MATCH formula in excel is very simple and easy to use. Let understand the working of Excel Match Formula by some MATCH Excel examples.
MATCH Excel Example #1
Consider a MATCH Excel example for exact match value. Suppose you have a data table with S.N., Name, and Dept. name and you have to find out the position of an employee whose name is ‘Tanuj’ then you can use MATCH Formula in excel with 0 match type to return the exact position of ‘Tanuj’ in the table array.
= MATCH(F4,$B$4:$B$13,0) the output is 1.
MATCH Excel Example #2
Consider the MATCH Excel example for approximate match value. Suppose you have a list of values wherein you need to find out the approximate position of any value here we have searched for ‘525’ and it will return an approximate position for it.
= MATCH(E19,B19:B28,1) output will be 5.
MATCH Excel Example #3
Match in Excel support (? & *) wildcard characters search in lookup value. You can understand MATCH Formula in Excel by using the below MATCH Excel example.
=MATCH(“*”&E33,$B$33:$B$42,0) the output will be 5.
MATCH Excel with INDEX Function – Example 4
MATCH in Excel with index function is used to lookup value in table from right to left.
Suppose you have to find out the S.N. of any employee by their name then you can achieve it by using a combination of excel match index function.
=INDEX(B46:D56,MATCH(G48,C46:C56,0),1) an output will be 1.
Things to Remember
- Match is not case-sensitive
- It considers tanuj and Tanuj as same value means it does not distinguish b/w lower case and upper case.
- MATCH in Excel returns the #N/A error if there is no matching value is found in the lookup_array.
- The Excel MATCH function returns the position value of the lookup value in the lookup_array, not the value itself.
- If there are multiple match values in lookup_array then it will return first exact match value.
- If match_type is 0 and lookup_value is text, then this function supports the use of wildcard characters question mark (?) and asterisk (*) in lookup_value.
Recommended Articles
This has been a guide to MATCH Excel Function. Here we discuss the MATCH Formula in excel and how to use the MATCH Excel with INDEX function along with practical MATCH Excel examples and downloadable excel templates. You may also have a look at these other lookup and reference functions in excel.