Excel find column for value

Excel helps in analyzing small or large data files containing multiple values. Sometimes, we have to find a specific value from a column in Excel, but it becomes tricky because manually we cannot handle the larger workbooks. It definitely takes time and needs more effort to be able to Excel search columns for value one by one.

For this, we always tend to find some easy approach that can help us in performing such tasks. Today, we will talk about how you can find a column value in Excel using multiple methods.

Below we have a dataset containing entries of some customers in a Store with the Customer ID, shopping Amount on a specific date, and the Total amount of their shopping done previously.

3 Methods of Excel Search Column for Value

Find Value in a Column in Excel using Conditional Formatting Feature  

Conditional Formatting lets you find any value in Excel. This method will explain how to find value in a specific column in your spreadsheet.

  1. Choose the column that has a specific value to be found.
  2. Select Cells C5 to C8 in Column C.

  1. Open the Home tab and select the Conditional Formatting option.
  2. Now, click on Highlight Cells Rules from the drop-down menu of Conditional Formatting.
  3. Click on the Equal To option.

  1. A pop-up will open where you have to enter the value you want to find out.
  2. Suppose you want to find a value of 500.
  3. Enter this value in the given section.
  4. You can choose the highlight color as well.
  5. Choose from the menu.

  1. In the end, the required value is colored on the selected column.

Find Value in Column in Excel using VLOOKUP Function

Using the VLOOKUP function, you can find a value in a column in Excel. For this, follow the steps given below:

  1. At first, a new column is created named Result that shows VLOOKUP.

  1. Go to Cell E5 and put the VLOOKUP function.
  2. From column range D5 to D8, you will find cell D5.
  3. In the argument section, put FALSE because it gives the exact result.
  4. The formula will be as: =VLOOKUP(C5, D5:D8, 1, FALSE).

  1. Press ENTER key.
  2. The selected value is there in the selected column.

You can even compare all the values of Column D with Column E. For this, you will have to follow some additional steps given below:

  1. Edit the formula and put a Dollar sign for Absolute Reference. The formula would be as:

=VLOOKUP(C5,$D$5:$D$8,1,FALSE)

  1. Press ENTER.
  2. Drag the Fill Handle icon from Cell E5.
  3. Ultimately, you will get the result of comparison Column D values on Column E.

You will notice the values from cells D5 and D7 are there in Column E. When using the VLOOKUP function, remember that the compared columns should be on the right side of the reference cell, or else the function is of no use.

Find value in Column in Excel using INDEX with MATCH Function

This method uses two functions mutually. The combo of INDEX and MATCH functions is mind-blowing because both of these functions can provide the required results. Let’s find out how this combo works.

Below you can see how the MATCH function works.

  1. Go to Cell E5 and make changes in the formula bar.
  2. Put the INDEX function and choose a cell collection where you need to find the value.
  3. After editing the formula will be as:

=INDEX(D5:D8,MATCH(C5,$D$5:$d$8, 0))

  1. Press the ENTER key and the results will be there.
  2. You will need to Autofill all the other cells in Column E if you need to display the results in the rest of the cells.
  3. Edit the formula and apply Absolute Reference before entering the above option.

The formula will be as: =INDEX($D$5:$D$8,MATCH(C5,$D$5:$D$8,0))

  1. Drag the Fill Handle icon to the last cell in Column E and the result will be there.

Final Thoughts

This post explains how you can find a specific value in a column by using different methods. You are now aware of how to use Conditional Formatting, VLOOKUP, MATCH, and INDEX functions to perform this task. Each method is vital and effective that’s why you must try them at least once.

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.

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!

You can use this (it will return E:E, which you could then use INDIRECT with to return a workable range). This uses «words» as the word to match and stop at the first match:

=SUBSTITUTE(
    ADDRESS(1,MATCH("words",$A$1:$Z$1,0),4),"1",
    ":"&
    SUBSTITUTE(ADDRESS(1,MATCH("words",$A$1:$Z$1,0),4),"1",""))

enter image description here

This works by using MATCH to find the position of the occurrence in your range (in this case, 5), and then using ADDRESS, with row_num = 1 and column_num = the result of the match. Using 4 for the abs_num argument ensures that the returned value will be without the $‘s. You then substitute out the 1 in E1 with «:» and concatenate it with the same formula, giving you E:E as a string. You can then do look-ups based on that range (using INDIRECT), such as this:

enter image description here

Last week I had an email from Mike asking how he can lookup a suburb in a range of columns and return the post code from the header row.

I imagine his data was a bit like this:

Excel find column containing a value

And in cell B9 he wants to find the post code for Herston.

One way is with this array formula:

=INDEX(B1:F1,,MIN(IF(B2:F5=A9,COLUMN(A:E))))

Entered with CTRL+SHIFT+ENTER.

Enter your email address below to download the sample workbook.

By submitting your email address you agree that we can email you our Excel newsletter.

Before we dive in, here are the syntaxes for the INDEX and IF functions as a reminder (I’ve crossed out the arguments we’re not using):

INDEX(reference,row_num,[column_num],[area_num])
IF(logical_test, [value_if_true],[value_if_false])

The INDEX formula is returning a reference to the cell in the first row for the column containing ‘Herston’. For the column_num argument it uses a combination of IF, COLUMN and MIN.

Here it is again for reference:

=INDEX(B1:F1,,MIN(IF(B2:F5=A9,COLUMN(A:E))))

In English the above formula reads:

Check the cells in the range B2:F5 for ‘Herston’ and tell INDEX what column number it’s in. i.e. column 4. INDEX (look in) the range B1:F1 and return a reference to the 4th cell i.e. E1, which contains 4006.

So what’s MIN got to do with it….hold your horses, more on that in a moment.

Let’s step through the formula in the order it evaluates:

Step 1 — IF function’s logical_test: B2:F5=A9 i.e. B2:F5=Herston and it looks like this:

=INDEX(B1:F1,,MIN(IF({FALSE,FALSE,FALSE,FALSE,FALSE;  FALSE,FALSE,FALSE,FALSE,FALSE; FALSE,FALSE,FALSE,TRUE,FALSE;  FALSE,FALSE,FALSE,FALSE,FALSE},,COLUMN(A:E))))

Tip: did you notice in the formula above there is a semicolon after every 5th ‘FALSE’ instead of a comma. This semicolon represents a new row in the array.

Or if you imagine our formula is putting together a list of values representing each row in the table like this:

Excel find column containing a value

Step 2 — COLUMN function: This evaluates to return a horizontal array of numbers {1,2,3,4,5} for our IF function’s value_if_true argument. These numbers represent the 5 columns B:F in our table.

Our formula now looks like this:

=INDEX(B1:F1,,MIN(IF({FALSE,FALSE,FALSE,FALSE,FALSE;FALSE,FALSE,FALSE,FALSE,FALSE;FALSE,FALSE,FALSE,TRUE,FALSE;FALSE,FALSE,FALSE,FALSE,FALSE},{1,2,3,4,5})))

Tip: Instead of using the COLUMN function to generate the array of numbers we could simply type {1,2,3,4,5} into the formula. However, with large horizontal arrays it’s quicker (and dynamic) if we use the COLUMN function to generate the array, or for vertical arrays you can use the ROW function.

Note: if you don’t want your COLUMN function to be dynamic you can use the INDIRECT function to fix it, like this:

=INDEX(B1:F1,,MIN(IF(B2:F5=A9,COLUMN(INDIRECT("A:E")))))

Step 3 — IF function value_if_true: The IF function finishes evaluating by assigning the value_if_true numbers (generated by the COLUMN function) to the TRUE results in the logical_test.

To visualise this we can look at the 3rd horizontal array (i.e. the series of FALSE/TRUE after the second semicolon below). Remember this is the 3rd row of our table above.

Excel gives the TRUE results the corresponding number from the array generated from the COLUMN function {1,2,3,4,5} like so:

Excel find column containing a value

Note: In this step the FALSE values evaluate to nothing i.e. they are ignored. Remember we don’t have a value_if_false argument in our IF formula. Our formula now looks like this:

Excel find column containing a value

Step 4 – MIN: This simply evaluates to find the one and only number; 4.

=INDEX(B1:F1,, 4)

Tip: Since there is only one number remaining (the rest are all FALSE) we could have used MAX or SUM to get the same result as MIN.

Step 5 – INDEX: Finally INDEX can return a reference to the 4th column in the range B1:F1 which is cell E1 containing post code 4006.

Tip: Notice how our INDEX formula doesn’t have a row_num argument:

Excel find column containing a value

Since our reference is only one row high we don’t have to type a 1 in for the row_num argument, we simply enter a comma as a placeholder and continue on to the column_num argument.

What The?

Did you find that tricky?

When working with long or complex formulas I like to use the Evaluate Formula tool to understand what’s going on behind the scenes.

You can also evaluate parts of your formula by highlighting the section of the function in the formula bar and pressing the F9 key. Below I’ve evaluated the COLUMN(A:E) part of my formula:

Excel find column containing a value

To revert to the original formula either press the escape key or CTRL+Z.

Thanks

Thanks to Mike for inspiring this post.

If you liked this please share it with your friends and colleagues.

Simply use the icons below to share it on Google +1, LinkedIn, Facebook and Twitter, or leave me a comment and tell me what formula would you use to find the Post Code?

Like this post? Please share to your friends:
  • Excel find cell with value
  • Excel find any text in cell
  • Excel find and replace not in formulas
  • Excel find and replace in one column
  • Excel find and remove