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:

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. maximum volume.
  5. In the cell F1 you need to enter the second:
  6. For confirmation, to press the key combination CTRL + SHIFT + Enter again.
found.

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. Formula.
  5. In the cell F1, you need to enter the second:
  6. You need to click CTRL + SHIFT + Enter for confirmation again.
Exaple.

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!

Download example search values in the columns and rows

Read also: The searching of the value in a range Excel table in columns and rows

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!


en ru