Basic Usage of INDEX & MATCH – Case Sensitive Lookup

In Excel, INDEX function and MATCH function are often used together for retrieving data from a particular position. MATCH function is one of Excel lookup & reference functions that can perform approximate match or exact match by setting different match types. They are not case-sensitive functions. If we need to perform a case-sensitive lookup, we need help from other functions.

Today, we will show you the usage of INDEX and MATCH with the help of EXACT function to perform a case-sensitive lookup. This formula will help you to retrieve data from a particular position of a given table based on the input lookup value exactly (case-sensitive). If you meet similar scenarios in your daily work, you can directly use this formula to deal with your problem.

EXAMPLE

In this example, “Cathy” and “CATHY” are duplicate with different HR ID. To calculate working hours for “CATHY” correctly, we need to ignore “Cathy” and find out “CATHY” exactly, then retrieve correct working hours “9.5 hours” from cell C4 properly. To solve this problem, we can create a formula that can perform case-sensitive lookup and retrieves data from particular position based on the lookup value.

Before creating the formula, to make cell reference and range reference used in the formula are easy to understand, we named range (B2:B5) to “Names”, (C2:C5) to “Hours”. In this example, we will apply INDECT & MATCH functions together to perform an exact match. To perform case-sensitive lookup, we also apply EXACT function together with above two functions to help us.

ANALYSIS

The formula must meet the following conditions:

1. It can scan values from “Names” and find out lookup value “CATHY” properly.

2. As we have two “Cathy” in “Names”, we need to ignore the first one as except the first letter, others are entered in lowercase. But for our input value “CATHY”, all five letters are entered in UPPERCASE. They are different if case sensitive.

3. After confirming the position of “CATHY” in range “Names”, it can retrieve data from the position just adjacent to “CATHY” in range “Hours”.

4. It returns proper working hours get in step#3 after performing the formula.

Actually, there are some powerful functions that can look up value effectively and powerfully, for example VLOOKUP function, we can use it to figure out most lookup cases in Excel. Besides, we can also apply function combinations to lookup values, for example INDEX and MATCH functions are good partners for retrieving data from a particular position. MATCH function can return the relative position of lookup value from a given table, and INDEXT can retrieve the data which is corresponding to the input value according to the position. And in Excel EXACT function can determine if strings are the same due to it is case sensitive. So, we will apply INDEX and MATCH together with EXACT function to create the formula to perform case-sensitive lookup:

=INDEX(Hours,MATCH(TRUE,EXACT(E2,Names),0))

FORMULA

Input formula =INDEX(Hours,MATCH(TRUE,EXACT(E2,Names),0)) into F2, as this is an array formula, we must press Control+Shift+Enter, verify that “9.5 hours” is returned properly.

In Excel 365, you can directly press Enter.

FUNCTION INTRODUCTION

a.INDEX function returns a value or a reference based on given cell or range reference.

 For array form:

Syntax:

=INDEX(array, row_num, [column_num])

 For reference form:

Syntax:

=INDEX(reference, row_num, [column_num], [area_num])

 There are two forms of INDEX functions. When applying INDEX with reference form, INDEX returns reference of the intersection of a particular row and column. You can apply array form if the first argument to INDEX is an array constant.

 

b. MATCH function returns the relative position of a cell from a range which cell contains specific item.

Syntax:

=MATCH(lookup_value, lookup_array, [match_type])

 

c. EXACT function is case-sensitive, it can detect whether two strings are exactly the same. If yes, it returns TRUE, else it returns FALSE.

Syntax:

=EXACT(text1, text2)

 

EXPLANATION

=INDEX(Hours,MATCH(TRUE,EXACT(E2,Names),0))

a. EXACT(E2,Names) performs a case-sensitive comparison between value in E2 (“CATHY”) and values in “Names”({“Cathy”;”Doris”;”CATHY”;”Ada”}). It returns “TRUE” if the two strings are exactly the same. So, after comparison, we get below an array of “TRUE” and “FALSE”:

{FALSE;FALSE;TRUE;FALSE}

{FALSE;FALSE;TRUE;FALSE} is delivered to MATCH function as lookup_array directly. In this array, “TRUE” represents “CATHY”, its position in the array reflects the position of “CATHY” in range “Names”.

 

b. MATCH(TRUE,{FALSE;FALSE;TRUE;FALSE},0) returns the relative position of input lookup value “TRUE” from array {FALSE;FALSE;TRUE;FALSE} which is returned by EXACT. As “TRUE” is at the third position in the array, so MATCH returns 3.

There are three match types, to perform an exact match comparison, we set match type to 0.

c. Above result “3” is delivered to INDEX function as row number. Expand values in “Score”. INDEX(Hours,3) returns the value in the third row of range “Hours” as the final result.

=INDEX({"9 hours";"10 hours";"9.5 hours";"8 hours"},3)

// returns “9.5 hours” finally

Related Functions


  • Excel INDEX function
    The Excel INDEX function returns a value from a table based on the index (row number and column number)The INDEX function is a build-in function in Microsoft Excel and it is categorized as a Lookup and Reference Function.The syntax of the INDEX function is as below:= INDEX (array, row_num,[column_num])…
  • Excel MATCH  function
    The Excel MATCH function search a value in an array and returns the position of that item.The MATCH function is a build-in function in Microsoft Excel and it is categorized as a Lookup and Reference Function.The syntax of the MATCH function is as below:= MATCH  (lookup_value, lookup_array, [match_type])….
  • Excel EXACT function
    The Excel EXACT function compares if two text strings are the same and returns TRUE if they are the same, Or, it will return FALSE.The syntax of the EXACT function is as below:= EXACT (text1,text2)…

 

 

Related Posts

Break ties with helper COUNTIF and column

Suppose you got a task to adjust the values that contain the ties; what would be your first attempt to break the ties of the given value? If you are wondering about doing this task manually, let me add that ...

Find the Closest Data to the Data Provided in Excel

In our daily work, we may encounter such an issue that to find the closest value to a certain value. In fact, Excel internal functions can help us solve this problem. In today’s article, we will show you how to ...

Abbreviate Names Or Words in Excel
abbreviate names1

As an MS Excel user, you might have come across a task where you need to abbreviate different names or words, and there are also possibilities that you might have done this task manually by assuming that there isn't any ...

Convert State Names To Abbreviations
abbr state names1

Assume that you got a task to convert the full state's name into the abbreviations in MS Excel, and for doing this task, you might choose to do it manually, which is an acceptable way only if you don't have ...

Filter or Remove Columns
filter remove columns1

Assume that in MS Excel, you have a table consisting of a few columns consisting of few values, and you want to filter to remove the specified columns from the table. You might take it easy and would prefer to ...

Filter or Extract for Multiple OR Criteria
filter with multiple criteria1

If you are an valid MS Excel user, you have probably come across a situation where you wanted to filter the data in a separate table with specific criteria. You could do this task manually, which is also acceptable when ...

Filter Multiple Values
filter multiple value1

In Excel, you can easily filter a table to display only the rows that meet your criteria. This is a quick way to find the information you need without scrolling through all the data. In this post, we'll show you ...

Excel XLOOKUP Function

Excel XLOOKUP Function was added into Excel as a beta feature in August 2019 and is now accessible exclusively in Microsoft 365. (as of July 2021). However, if you fall into this category and often deal with big sets of ...

Extract or Filter Top n values
filter on top n values

You might have been through this kind of situation where you need to filter out the top n values from the list having few values, and I am also pretty sure about it that you might have chosen to do ...

Extract Unique Items From A List
Extract Unique Items From A List In Excel1

This post will guide you how to extract unique itmes from a given list in Microsoft Excel. How to create a newly formula to get unique values from a range cells in Excel. The unique list of items is the ...

Sidebar