Excel search for value in cell

Summary

This step-by-step article describes how to find data in a table (or range of cells) by using various built-in functions in Microsoft Excel. You can use different formulas to get the same result.

Create the Sample Worksheet

This article uses a sample worksheet to illustrate Excel built-in functions. Consider the example of referencing a name from column A and returning the age of that person from column C. To create this worksheet, enter the following data into a blank Excel worksheet.

You will type the value that you want to find into cell E2. You can type the formula in any blank cell in the same worksheet.

A

B

C

D

E

1

Name

Dept

Age

Find Value

2

Henry

501

28

Mary

3

Stan

201

19

4

Mary

101

22

5

Larry

301

29

Term Definitions

This article uses the following terms to describe the Excel built-in functions:

Term

Definition

Example

Table Array

The whole lookup table

A2:C5

Lookup_Value

The value to be found in the first column of Table_Array.

E2

Lookup_Array
-or-
Lookup_Vector

The range of cells that contains possible lookup values.

A2:A5

Col_Index_Num

The column number in Table_Array the matching value should be returned for.

3 (third column in Table_Array)

Result_Array
-or-
Result_Vector

A range that contains only one row or column. It must be the same size as Lookup_Array or Lookup_Vector.

C2:C5

Range_Lookup

A logical value (TRUE or FALSE). If TRUE or omitted, an approximate match is returned. If FALSE, it will look for an exact match.

FALSE

Top_cell

This is the reference from which you want to base the offset. Top_Cell must refer to a cell or range of adjacent cells. Otherwise, OFFSET returns the #VALUE! error value.

Offset_Col

This is the number of columns, to the left or right, that you want the upper-left cell of the result to refer to. For example, «5» as the Offset_Col argument specifies that the upper-left cell in the reference is five columns to the right of reference. Offset_Col can be positive (which means to the right of the starting reference) or negative (which means to the left of the starting reference).

Functions

LOOKUP()

The LOOKUP function finds a value in a single row or column and matches it with a value in the same position in a different row or column.

The following is an example of LOOKUP formula syntax:

   =LOOKUP(Lookup_Value,Lookup_Vector,Result_Vector)


The following formula finds Mary’s age in the sample worksheet:

   =LOOKUP(E2,A2:A5,C2:C5)

The formula uses the value «Mary» in cell E2 and finds «Mary» in the lookup vector (column A). The formula then matches the value in the same row in the result vector (column C). Because «Mary» is in row 4, LOOKUP returns the value from row 4 in column C (22).

NOTE: The LOOKUP function requires that the table be sorted.

For more information about the LOOKUP function, click the following article number to view the article in the Microsoft Knowledge Base:
 

How to use the LOOKUP function in Excel

VLOOKUP()

The VLOOKUP or Vertical Lookup function is used when data is listed in columns. This function searches for a value in the left-most column and matches it with data in a specified column in the same row. You can use VLOOKUP to find data in a sorted or unsorted table. The following example uses a table with unsorted data.

The following is an example of VLOOKUP formula syntax:

    =VLOOKUP(Lookup_Value,Table_Array,Col_Index_Num,Range_Lookup)

The following formula finds Mary’s age in the sample worksheet:

   =VLOOKUP(E2,A2:C5,3,FALSE)

The formula uses the value «Mary» in cell E2 and finds «Mary» in the left-most column (column A). The formula then matches the value in the same row in Column_Index. This example uses «3» as the Column_Index (column C). Because «Mary» is in row 4, VLOOKUP returns the value from row 4 in column C (22).

For more information about the VLOOKUP function, click the following article number to view the article in the Microsoft Knowledge Base:
 

How to Use VLOOKUP or HLOOKUP to find an exact match

INDEX() and MATCH()

You can use the INDEX and MATCH functions together to get the same results as using LOOKUP or VLOOKUP.

The following is an example of the syntax that combines INDEX and MATCH to produce the same results as LOOKUP and VLOOKUP in the previous examples:

    =INDEX(Table_Array,MATCH(Lookup_Value,Lookup_Array,0),Col_Index_Num)

The following formula finds Mary’s age in the sample worksheet:


    =INDEX(A2:C5,MATCH(E2,A2:A5,0),3)

The formula uses the value «Mary» in cell E2 and finds «Mary» in column A. It then matches the value in the same row in column C. Because «Mary» is in row 4, the formula returns the value from row 4 in column C (22).

NOTE: If none of the cells in Lookup_Array match Lookup_Value («Mary»), this formula will return #N/A.
For more information about the INDEX function, click the following article number to view the article in the Microsoft Knowledge Base:

How to use the INDEX function to find data in a table

OFFSET() and MATCH()

You can use the OFFSET and MATCH functions together to produce the same results as the functions in the previous example.

The following is an example of syntax that combines OFFSET and MATCH to produce the same results as LOOKUP and VLOOKUP:

   =OFFSET(top_cell,MATCH(Lookup_Value,Lookup_Array,0),Offset_Col)

This formula finds Mary’s age in the sample worksheet:

   =OFFSET(A1,MATCH(E2,A2:A5,0),2)

The formula uses the value «Mary» in cell E2 and finds «Mary» in column A. The formula then matches the value in the same row but two columns to the right (column C). Because «Mary» is in column A, the formula returns the value in row 4 in column C (22).

For more information about the OFFSET function, click the following article number to view the article in the Microsoft Knowledge Base:
 

How to use the OFFSET function

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

When working with Excel, we see so many peculiar situations. One of those situations is searching for the particular text in the cell. The first thing that comes to mind when we say we want to search for a specific text in the worksheet is the “Find and Replace” method in Excel, which is the most popular one. But Ctrl + F can find the text you are looking for but cannot go beyond that. So, for example, if the cell contains certain words, you may want the result in the next cell as “TRUE” or “FALSE.” So, Ctrl + F stops there.

Table of contents
  • How to Search For Text in Excel?
    • Which Formula Can Tell Us A Cell Contains Specific Text?
    • Alternatives to FIND Function
      • Alternative #1 – Excel Search Function
      • Alternative #2 – Excel Countif Function
    • Highlight the Cell which has Particular Text Value
    • Recommended Articles

Search For Text in Excel

Here, we will take you through the formulas to search for the particular text in the cell value and arrive at the result.

You can download this Search For Text Excel Template here – Search For Text Excel Template

Which Formula Can Tell Us A Cell Contains Specific Text?

It is a question we have seen many times in Excel forums. The first formula that came to mind was the “FIND” function.

The FIND function can return the position of the supplied text values in the string. So, if the FIND method returns any number, then we can consider the cell as it has the text or else not.

  1. For example, look at the below data.

    Search For Text Excel Example 1

  2. In the above data, we have three sentences in three different rows. Now in each cell, we need to search for the text “Best.” So, apply the FIND function.

    Search For Text Excel Example 1-1

  3. The “find_text” argument mentions the text we need to find.

    Search For Text Excel Example 1-2

  4. For the “within_text,” select the full sentence, i.e., cell reference.

    Search For Text Excel Example 1-3

  5. The last parameter is not required to close the bracket and press the “Enter” key.

    Search For Text Excel Example 1-4

    So, in two sentences, we have the word “best.” We can see the error value of #VALUE! in cell B2, which shows that cell A2 does not have the text value “best.”

  6. Instead of numbers, we can also enter the result in our own words. For this, we need to use the IF condition.

    Search For Text Excel Example 1-5

So, in the IF condition, we have supplied the result as “Text Found” if the value “best” is found. Otherwise, we have provided the result as “Not Found.”

But, here we have a problem, even though we have supplied the result as “Not Found,” if the text is still not found, we are getting the error value as #VALUE!.

So, nobody wants to have an error value in their Excel sheet. Therefore, we must enclose the formula with the ISNUMERIC function to overcome this error value.

Search For Text Excel Example 1-6

The ISNUMERIC function evaluates whether the FIND function returns the number or not. If the FIND function returns the number, it will supply TRUE to the IF condition or else FALSE condition. Based on the result provided by the ISNUMERIC function, the IF condition will return the result accordingly.

We can also use the IFERROR function in excelThe IFERROR function in Excel checks a formula (or a cell) for errors and returns a specified value in place of the error.read more to deal with error values instead of ISNUMERIC. For example, the below formula will also return “Not Found” if the FIND function returns the error value.

Search For Text Excel Example 1-7

Alternatives to FIND Function

Alternative #1 – Excel Search Function

Instead of the FIND function, we can also use the SEARCH function in excelSearch function gives the position of a substring in a given string when we give a parameter of the position to search from. As a result, this formula requires three arguments. The first is the substring, the second is the string itself, and the last is the position to start the search.read more to search the particular text in the string. The syntax of the SEARCH function is the same as the FIND function.

Alternative to FIND Function 1

Supply the “find_text” as “Best.”

Alternative to FIND Function 1-1

The “within_text” is our cell reference.

Alternative to FIND Function 1-2

Even the SEARCH function returns an error value as #VALUE! If the finding text “best” is not found. As we have seen above, we need to enclose the formula with ISNUMERIC or IFERROR functions.

Alternative #2 – Excel Countif Function

Another way to search for a particular text is using the COUNTIF functionThe COUNTIF function in Excel counts the number of cells within a range based on pre-defined criteria. It is used to count cells that include dates, numbers, or text. For example, COUNTIF(A1:A10,”Trump”) will count the number of cells within the range A1:A10 that contain the text “Trump”
read more
. This function works without any error.

Alternative to FIND Function 1-3

In the range, the argument selects the cell reference.

Alternative to FIND Function 1-4

In the criteria column, we need to use a wildcard in excelIn Excel, wildcards are the three special characters asterisk, question mark, and tilde. Asterisk denotes multiple characters, a question mark denotes a single character, and a tilde denotes the identification of a wild card character.read more because we are just finding the part of the string value, so enclose the word “best” with an asterisk (*) wildcard.

Alternative to FIND Function 1-5

This formula will return the word “best” count in the selected cell value. Since we have only one “best” value, we will get only 1 as the count.

Alternative to FIND Function 1-6

We can apply only the IF condition to get the result without error.

Alternative to FIND Function 1-7

Highlight the Cell which has a Particular Text Value

If you are not a fan of formulas, you can highlight the cell with a particular word. For example, to highlight the cell with the word “best,” we need to use conditional formatting in excelConditional formatting is a technique in Excel that allows us to format cells in a worksheet based on certain conditions. It can be found in the styles section of the Home tab.read more.

First, select the data cells and click “Conditional Formatting” > “New Rule.”

Alternative to FIND Function 2

Under “New Rule,” select the “Format only cells that contain” option.

Alternative to FIND Function 2-1

From the first dropdown, select “Specific Text.”

Alternative to FIND Function 2-2

The formula section enters the text we search for in double quotes with the equal sign. =’best.’

Alternative to FIND Function 2-3

Then, click on “FORMAT” and choose the formatting style.

Alternative to FIND Function 2-4

Click on “OK.” It will highlight all the cells which have the word “best.”

Alternative to FIND Function 2-5

Using various techniques, we can search the particular text in Excel.

Recommended Articles

This article is a guide to Search For Text in Excel. Here, we discuss the top three methods to search the cell value for a specific text and arrive at the result with practical examples and a downloadable Excel template. You may learn more about Excel from the following articles: –

  • Find Links in Excel
  • Using Find and Select in Excel
  • Search Box in Excel

Содержание

  1. Поиск данных в таблице или диапазоне ячеек с помощью встроенных функций Excel
  2. Описание
  3. Создание образца листа
  4. Определения терминов
  5. Функции
  6. LOOKUP ()
  7. INDEX () и MATCH ()
  8. СМЕЩ () и MATCH ()
  9. Finding of the value in the column and the row of the Excel table
  10. Finding values in the Excel table
  11. Search of the value in the Excel ROW
  12. The principle of the formula for finding the value in the Excel ROW:
  13. How can I get to the column headings from a single cell value?
  14. Search the value in the Excel column
  15. The principle of the formula for finding the value in the Excel column
  16. Look up values in a list of data
  17. What do you want to do?
  18. Look up values vertically in a list by using an exact match
  19. VLOOKUP examples
  20. INDEX and MATCH examples
  21. Look up values vertically in a list by using an approximate match
  22. Look up values vertically in a list of unknown size by using an exact match
  23. Look up values horizontally in a list by using an exact match
  24. Look up values horizontally in a list by using an approximate match
  25. Create a lookup formula with the Lookup Wizard (Excel 2007 only)

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

Примечание: Мы стараемся как можно оперативнее обеспечивать вас актуальными справочными материалами на вашем языке. Эта страница переведена автоматически, поэтому ее текст может содержать неточности и грамматические ошибки. Для нас важно, чтобы эта статья была вам полезна. Просим вас уделить пару секунд и сообщить, помогла ли она вам, с помощью кнопок внизу страницы. Для удобства также приводим ссылку на оригинал (на английском языке).

Описание

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

Создание образца листа

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

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

Определения терминов

В этой статье для описания встроенных функций Excel используются указанные ниже условия.

Вся таблица подстановки

Значение, которое будет найдено в первом столбце аргумента «инфо_таблица».

Просматриваемый_массив
-или-
Лукуп_вектор

Диапазон ячеек, которые содержат возможные значения подстановки.

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

3 (третий столбец в инфо_таблица)

Ресулт_аррай
-или-
Ресулт_вектор

Диапазон, содержащий только одну строку или один столбец. Он должен быть такого же размера, что и просматриваемый_массив или Лукуп_вектор.

Логическое значение (истина или ложь). Если указано значение истина или опущено, возвращается приближенное соответствие. Если задано значение FALSE, оно будет искать точное совпадение.

Это ссылка, на основе которой вы хотите основать смещение. Топ_целл должен ссылаться на ячейку или диапазон смежных ячеек. В противном случае функция СМЕЩ возвращает #VALUE! значение ошибки #ИМЯ?.

Число столбцов, находящегося слева или справа от которых должна указываться верхняя левая ячейка результата. Например, значение «5» в качестве аргумента Оффсет_кол указывает на то, что верхняя левая ячейка ссылки состоит из пяти столбцов справа от ссылки. Оффсет_кол может быть положительным (то есть справа от начальной ссылки) или отрицательным (то есть слева от начальной ссылки).

Функции

LOOKUP ()

Функция Просмотр находит значение в одной строке или столбце и сопоставляет его со значением в той же позицией в другой строке или столбце.

Ниже приведен пример синтаксиса формулы подСТАНОВКи.

= Просмотр (искомое_значение; Лукуп_вектор; Ресулт_вектор)

Следующая формула находит возраст Марии на листе «образец».

= ПРОСМОТР (E2; A2: A5; C2: C5)

Формула использует значение «Мария» в ячейке E2 и находит слово «Мария» в векторе подстановки (столбец A). Формула затем соответствует значению в той же строке в векторе результатов (столбец C). Так как «Мария» находится в строке 4, функция Просмотр возвращает значение из строки 4 в столбце C (22).

Примечание. Для функции Просмотр необходимо, чтобы таблица была отсортирована.

Чтобы получить дополнительные сведения о функции Просмотр , щелкните следующий номер статьи базы знаний Майкрософт:

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

Ниже приведен пример синтаксиса формулы ВПР :

= ВПР (искомое_значение; инфо_таблица; номер_столбца; интервальный_просмотр)

Следующая формула находит возраст Марии на листе «образец».

= ВПР (E2; A2: C5; 3; ЛОЖЬ)

Формула использует значение «Мария» в ячейке E2 и находит слово «Мария» в левом столбце (столбец A). Формула затем совпадет со значением в той же строке в Колумн_индекс. В этом примере используется «3» в качестве Колумн_индекс (столбец C). Так как «Мария» находится в строке 4, функция ВПР возвращает значение из строки 4 В столбце C (22).

Чтобы получить дополнительные сведения о функции ВПР , щелкните следующий номер статьи базы знаний Майкрософт:

INDEX () и MATCH ()

Вы можете использовать функции индекс и ПОИСКПОЗ вместе, чтобы получить те же результаты, что и при использовании поиска или функции ВПР.

Ниже приведен пример синтаксиса, объединяющего индекс и Match для получения одинаковых результатов поиска и ВПР в предыдущих примерах:

= Индекс (инфо_таблица; MATCH (искомое_значение; просматриваемый_массив; 0); номер_столбца)

Следующая формула находит возраст Марии на листе «образец».

= ИНДЕКС (A2: C5; MATCH (E2; A2: A5; 0); 3)

Формула использует значение «Мария» в ячейке E2 и находит слово «Мария» в столбце A. Затем он будет соответствовать значению в той же строке в столбце C. Так как «Мария» находится в строке 4, формула возвращает значение из строки 4 в столбце C (22).

Обратите внимание Если ни одна из ячеек в аргументе «число» не соответствует искомому значению («Мария»), эта формула будет возвращать #N/А.
Чтобы получить дополнительные сведения о функции индекс , щелкните следующий номер статьи базы знаний Майкрософт:

СМЕЩ () и MATCH ()

Функции СМЕЩ и ПОИСКПОЗ можно использовать вместе, чтобы получить те же результаты, что и функции в предыдущем примере.

Ниже приведен пример синтаксиса, объединяющего смещение и сопоставление для достижения того же результата, что и функция Просмотр и ВПР.

= СМЕЩЕНИЕ (топ_целл, MATCH (искомое_значение; просматриваемый_массив; 0); Оффсет_кол)

Эта формула находит возраст Марии на листе «образец».

= СМЕЩЕНИЕ (A1; MATCH (E2; A2: A5; 0); 2)

Формула использует значение «Мария» в ячейке E2 и находит слово «Мария» в столбце A. Формула затем соответствует значению в той же строке, но двум столбцам справа (столбец C). Так как «Мария» находится в столбце A, формула возвращает значение в строке 4 в столбце C (22).

Чтобы получить дополнительные сведения о функции СМЕЩ , щелкните следующий номер статьи базы знаний Майкрософт:

Источник

Finding of the value in the column and the row of the Excel table

We have the table in which the sales volumes of certain products are recorded in different months. It is necessary to find the data in the table, and the search criteria will be the headings of rows and columns. But the search must be performed separately by the range of the row or column. That is, only one of the criteria will be used. Therefore, you can`t apply the INDEX function here, but you need a special formula.

Finding values in the Excel table

To solve this problem, let us illustrate the example in the schematic table that corresponds to the conditions are described above.

The sheet with the table to search for values vertically and horizontally:

Above this table we can see the row with results. In the cell B1 we introduce the criterion for the search query, that is, the column header or the ROW name. And in the cell D1, to a search formula should return to the result of the calculation of the corresponding value. Then the second formula will work in the cell F1. She will already use the values of the cells B1 and D1 as the criteria for searching of the corresponding month.

Search of the value in the Excel ROW

Now we are learning, in what maximum volume and in what month has been the maximum sale of the Product 4.

To search by columns:

  1. In the cell B1 you need to enter the value of the Product 4 — the name of the row, that will act as the criterion.
  2. In the cell D1 you need to enter the following:
  3. To confirm after entering the formula, you need to press the CTRL + SHIFT + Enter hotkey combination, because she must be executed in the array. If everything is done correctly, the curly braces will appear in the formula ROW.
  4. In the cell F1 you need to enter the second:
  5. For confirmation, to press the key combination CTRL + SHIFT + Enter again.

So we have found, in what month and what was the largest sale of the Product 4 for two quarters.

The principle of the formula for finding the value in the Excel ROW:

In the first argument of the VLOOKUP function (Vertical Look Up), indicates to the reference to the cell, where the search criterion is located. In the second argument indicates to the range of the cells for viewing during in the process of searching.

In the third argument of the VLOOKUP function should be indicated the number of the column from which you should to take the value against of the row named the Item 4. But since we do not previously know this number, we use the COLUMN function for creating the array of column numbers for the range B4:G15.

This allows the VLOOKUP function to collect the whole array of values. As a result, all relevant values are stored in memory for each column in the row Product 4 (namely: 360; 958; 201; 605; 462; 832). After that, the MAX function will only take the maximum number from this array and return it as the value for the cell D1, as the result of calculating.

As you can see, the construction of the formula is simple and concise. On its basis, it is possible in a similar way to find other indicators for a certain product. For example, the minimum or an average value of sales volume you need to find using for this purpose MIN or AVERAGE functions. Nothing hinders you from applying this skeleton of the formula to apply with more complex functions for implementation the most comfortable analysis of the sales report.

How can I get to the column headings from a single cell value?

For example, how effectively we displayed the month with the maximum sale, using of the second. It’s not difficult to notice that in the second formula we used the skeleton of the first formula without the MAX function. The main structure of the function is: VLOOKUP. We replaced the MAX on the MATCH, which in the first argument uses the value obtained by the previous formula. It acts as the criterion for searching for the month now.

And as a result, the MATCH function returns the column number 2, where the maximum value of the sales volume for the product is located for the product 4. After that, the INDEX function is included in the work. This function returns the value by the number of terms and column from the range specified in its arguments. Because the we have the number of column 2, and the row number in the range where the names of months are stored in any cases will be the value 1. Then we have the INDEX function to get the corresponding value from the range of B4:G4 — February (the second month).

Search the value in the Excel column

The second version of the task will be searching in the table with using the month name as the criterion. In such cases, we have to change the skeleton of our formula: the VLOOKUP function is replaced by the HLOOKUP (Horizontal Look Up) one, and the COLUMN function is replaced by the row one.

This will allow us to know what volume and what of the product the maximum sale was in a certain month.

To find what kind of the product had the maximum sales in a certain month, you should:

  1. In the cell B2 to enter the name of the month June — this value will be used as the search criterion.
  2. In the cell D2, you should to enter the formula:
  3. To confirm after entering the formula you need to press the combination of keys CTRL + SHIFT + Enter, as this formula will be executed in the array. And the curly braces will appear in the function ROW.
  4. In the cell F1, you need to enter the second:
  5. You need to click CTRL + SHIFT + Enter for confirmation again.

The principle of the formula for finding the value in the Excel column

In the first argument of the HLOOKUP function, we indicate to the reference by the cell with the criterion for the search. In the second argument specifies the reference to the table argument being scanned. The third argument is generated by the ROW function, what creates in the array of ROW numbers of 10 elements in memory. So there are 10 rows in the table section.

Further the HLOOKUP function, alternately using to each number of the row, creates the array of corresponding sales values from the table for the certain month (June). Further, the MAX function is left only to select the maximum value from this array.

Then just a little modifying to the first formula by using the INDEX and MATCH functions, we created the second function to display the names of the table rows according to the cell value. The names of the corresponding rows (products) we output in F2.

ATTENTION! When using the formula skeleton for other tasks, you need always to pay attention to the second and the third argument of the search HLOOKUP function. The number of covered rows in the range is specified in the argument, must match with the number of rows in the table. And also the numbering should begin with the second ROW!

Indeed, the content of the range generally we don’t care — we just need the row counter. That is, you need to change the arguments to: ROW(B2:B11) or ROW(C2:C11) — this does not affect in the quality of the formula. The main thing is that — there are 10 rows in these ranges, as well as in the table. And the numbering starts from the second row!

Источник

Look up values in a list of data

Let’s say that you want to look up an employee’s phone extension by using their badge number, or the correct rate of a commission for a sales amount. You look up data to quickly and efficiently find specific data in a list and to automatically verify that you are using correct data. After you look up the data, you can perform calculations or display results with the values returned. There are several ways to look up values in a list of data and to display the results.

What do you want to do?

Look up values vertically in a list by using an exact match

To do this task, you can use the VLOOKUP function, or a combination of the INDEX and MATCH functions.

VLOOKUP examples

For more information, see VLOOKUP function.

INDEX and MATCH examples

In simple English it means:

=INDEX(I want the return value from C2:C10, that will MATCH(Kale, which is somewhere in the B2:B10 array, where the return value is the first value corresponding to Kale))

The formula looks for the first value in C2:C10 that corresponds to Kale (in B7) and returns the value in C7 ( 100), which is the first value that matches Kale.

Look up values vertically in a list by using an approximate match

To do this, use the VLOOKUP function.

Important: Make sure the values in the first row have been sorted in an ascending order.

In the above example, VLOOKUP looks for the first name of the student who has 6 tardies in the A2:B7 range. There is no entry for 6 tardies in the table, so VLOOKUP looks for the next highest match lower than 6, and finds the value 5, associated to the first name Dave, and thus returns Dave.

For more information, see VLOOKUP function.

Look up values vertically in a list of unknown size by using an exact match

To do this task, use the OFFSET and MATCH functions.

Note: Use this approach when your data is in an external data range that you refresh each day. You know the price is in column B, but you don’t know how many rows of data the server will return, and the first column isn’t sorted alphabetically.

C1 is the upper left cells of the range (also called the starting cell).

MATCH(«Oranges»,C2:C7,0) looks for Oranges in the C2:C7 range. You should not include the starting cell in the range.

1 is the number of columns to the right of the starting cell where the return value should be from. In our example, the return value is from column D, Sales.

Look up values horizontally in a list by using an exact match

To do this task, use the HLOOKUP function. See an example below:

HLOOKUP looks up the Sales column, and returns the value from row 5 in the specified range.

For more information, see HLOOKUP function.

Look up values horizontally in a list by using an approximate match

To do this task, use the HLOOKUP function.

Important: Make sure the values in the first row have been sorted in an ascending order.

In the above example, HLOOKUP looks for the value 11000 in row 3 in the specified range. It does not find 11000 and hence looks for the next largest value less than 1100 and returns 10543.

For more information, see HLOOKUP function.

Create a lookup formula with the Lookup Wizard (Excel 2007 only)

Note: The Lookup Wizard add-in was discontinued in Excel 2010. This functionality has been replaced by the function wizard and the available Lookup and reference functions (reference).

In Excel 2007, the Lookup Wizard creates the lookup formula based on a worksheet data that has row and column labels. The Lookup Wizard helps you find other values in a row when you know the value in one column, and vice versa. The Lookup Wizard uses INDEX and MATCH in the formulas that it creates.

Click a cell in the range.

On the Formulas tab, in the Solutions group, click Lookup.

If the Lookup command is not available, then you need to load the Lookup Wizard add-in program.

How to load the Lookup Wizard Add-in program

Click the Microsoft Office Button , click Excel Options, and then click the Add-ins category.

In the Manage box, click Excel Add-ins, and then click Go.

In the Add-Ins available dialog box, select the check box next to Lookup Wizard, and then click OK.

Источник

Transcript 

In this lesson, we’ll look at how to find things in Excel.

Let’s take a look.

To find a value in Excel, use the Find and Replace dialog box. You can access this dialog using the keyboard shortcut control-F, or, by using the Find and Select menu at the far right of the Home tab on the ribbon.

Let’s try looking for the name Ann. Nothing happens until we click the Find Next button. Then, each time we click, Excel finds another match.

Note that Excel finds other names that contain Ann as well—Annie, Ann, Danny, and then Hannah. If we continue clicking Find Next, Excel will eventually return to the first match.

By default, Excel searches left to right, first through rows, then columns. You can hold down the shift key when you press «Find Next» to move backwards.

Now let’s review the Find options.

The first option allows you to restrict the search to the current worksheet, or expand it to include the entire workbook. If we select workbook, Excel will now find matches on Sheet 2.

The «search» option determines the order that Excel looks through cells. The default is «By Rows.»  If we switch to «By Columns,» Excel will find all matches in one column before moving on to the next column.

There is also an option to search Formulas, Values, and Comments. We’ll look at these in a future lesson.

If we enable «Match case,» Excel treats case as important and only finds values that begin with a capital A.

If we enable «Match entire cell contents,» Excel will only find cells where the value is exactly Ann. This is a good way to find only the name Ann.

With the Find dialog closed, you can still find things with the keyboard shortcut Shift F4. Excel will use the current Find settings and select the next match.

Finally, it’s important to understand that if you have more than one cell selected, Excel will search only in the current selection. For example, if we select just a subset of our table, Excel will only search in that selection.

However, if you switch «Within» to «Workbook,» Excel will drop the current selection and search all cells. At this point, you can switch back to Worksheet to search only the current worksheet.

Sub Excel_SEARCH_Function()

Dim ws As Worksheet

Set ws = Worksheets(«SEARCH»)

ws.Range(«E5») = Application.WorksheetFunction.Search(ws.Range(«C5»), ws.Range(«B5»))
ws.Range(«E6») = Application.WorksheetFunction.Search(ws.Range(«C6»), ws.Range(«B6»), ws.Range(«D6»))
ws.Range(«E7») = Application.WorksheetFunction.Search(ws.Range(«C7»), ws.Range(«B7»), ws.Range(«D7»))

End Sub

OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.

PREREQUISITES
Worksheet Name: Have a worksheet named SEARCH.
String Range: Have the range of strings that you want to search within captured in range («B4:B7»).
Search sub-string: Have the sub-string that you want to search for in range («C5:C7»).
Start Position: In this example the start position only applies to the bottom two examples. Therefore, if using the exact same VBA code ensure that the start position value is captured in range («D6:D7»).

ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell references («E5»), («E6») and («E7») in the VBA code to any cell in the worksheet, that doesn’t conflict with formula.
String Range: Select the range of strings that you want to search within by changing the range («B5:B7») in the VBA code to any cell in the worksheet, that doesn’t conflict with formula.
Search sub-string: Select the sub-string that you want to search for by changing the cell references («C5»), («C6») and («C7») to any range in the worksheet, that doesn’t conflict with the formula.
Start Position: Select the start position value by changing the range («D6:D7») to any range in the worksheet, that doesn’t conflict with the formula.

Like this post? Please share to your friends:
  • Excel shapes select all
  • Excel saved as copy of
  • Excel shape textbox vba excel
  • Excel saveas перезаписать без подтверждения
  • Excel shape in cell