Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
โ† Data Analysis with Excel Functions ยท Lesson 8 of 9

Module Seven

๐Ÿ“– Every lesson in this course is free to read right here, no account needed. Create a free account to track your progress, take the exam, and earn your certificate.
8

Module 7: Lookup and Reference Functions in Excel

Module Introduction

Imagine you work in a school in Ibadan with records for 1,000 students. Each student has a name, registration number, class, and examination score.

Your teacher asks you to find the examination score of a student named Ade. Searching through all 1,000 records manually could take a long time.

Fortunately, Microsoft Excel has lookup and reference functions that help you find specific information quickly. Instead of checking every row yourself, you can enter a formula and allow Excel to search for the information.

Learning Objectives

By the end of this module, you should be able to:

  • Explain what lookup and reference functions do.
  • Understand how VLOOKUP works.
  • Use HLOOKUP to search horizontally.
  • Use XLOOKUP to find information more flexibly.
  • Understand the INDEX and MATCH functions.
  • Apply lookup functions to school and business records.

1. Understanding Lookup and Reference Functions

Lookup functions help you search for information in a spreadsheet and return related information from another cell.

For example, if you know a student's registration number, you can use a lookup function to find the student's name, class, or examination score.

These functions are especially useful when working with large datasets containing hundreds or thousands of records.

2. Understanding VLOOKUP

VLOOKUP means Vertical Lookup. It searches for information in the first column of a table and returns a related value from another column in the same row.

Think of it as asking Excel to find a student's registration number and return the student's examination score.

VLOOKUP Syntax

=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

Here is what each part means:

  • lookup_value: The information you want Excel to search for.
  • table_array: The range containing the information.
  • col_index_num: The column number containing the result you want.
  • range_lookup: TRUE for approximate matching or FALSE for exact matching.

Example: Finding a Student's Score

A school in Lagos has the following examination records:

Student ID Student Name Class Score
ST001AdeJSS 175
ST002ChikaJSS 290
ST003TundeJSS 165
ST004FatimaJSS 385

Assume the table is stored in cells A2:D5. You want to find the score of student ST002.

Enter this formula:

=VLOOKUP("ST002",A2:D5,4,FALSE)

Result: 90

Excel searches for ST002 in the first column, finds the student's row, and returns the value in the fourth column.

Understanding the Column Number

In the VLOOKUP formula, the column number is counted from the beginning of the selected table range, not from the entire worksheet.

  • Column A in the selected range is number 1.
  • Column B is number 2.
  • Column C is number 3.
  • Column D is number 4.

3. Understanding HLOOKUP

HLOOKUP means Horizontal Lookup. It searches for information across the first row of a table and returns a related value from another row.

While VLOOKUP searches vertically down a column, HLOOKUP searches horizontally across a row.

HLOOKUP Syntax

=HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])

Example: Finding Monthly Sales

Imagine a supermarket in Ibadan has arranged its monthly sales records horizontally.

Information January February March April
Sales (โ‚ฆ) 50000 65000 80000 75000
Expenses (โ‚ฆ) 20000 25000 30000 28000

Assume the table is stored in A1:E3. To find the sales amount for March, enter:

=HLOOKUP("March",A1:E3,2,FALSE)

Result: โ‚ฆ80,000

Excel searches for March in the first row and returns the value from the second row.

4. Understanding XLOOKUP

XLOOKUP is a modern lookup function that makes searching for information easier and more flexible.

Unlike VLOOKUP, XLOOKUP can search in one range and return information from another range, even when the result column is to the left of the search column.

XLOOKUP Syntax

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found])

Here is what the arguments mean:

  • lookup_value: The information you want to find.
  • lookup_array: The cells Excel should search.
  • return_array: The cells containing the information you want returned.
  • if_not_found: Optional message to display when no match is found.

Example: Finding a Student's Name

Using the student records from the earlier example, assume student IDs are in A2:A5 and names are in B2:B5.

To find the name of student ST003, enter:

=XLOOKUP("ST003",A2:A5,B2:B5,"Student Not Found")

Result: Tunde

If ST003 does not exist in the selected range, Excel displays Student Not Found.

Note: XLOOKUP is available in newer versions of Excel, including Microsoft 365 and Excel 2021 or later. Older versions may not support it.

5. Understanding the INDEX Function

INDEX returns a value from a specific position in a selected range.

Imagine you have a list of student names and want to retrieve the name in the third position. INDEX can help you do this.

INDEX Syntax

=INDEX(array, row_num, [column_num])

Example

Assume cells A2:A5 contain these names:

  • A2: Ade
  • A3: Chika
  • A4: Tunde
  • A5: Fatima

Enter:

=INDEX(A2:A5,3)

Result: Tunde

Excel returns the third value in the selected range.

6. Understanding the MATCH Function

MATCH searches for a value in a range and returns its position.

It does not return the actual information in the cell. Instead, it tells you where the matching value is located.

MATCH Syntax

=MATCH(lookup_value, lookup_array, [match_type])

For an exact match, use 0 as the match type.

Example

Assume the names Ade, Chika, Tunde, and Fatima are stored in cells A2:A5.

To find the position of Tunde, enter:

=MATCH("Tunde",A2:A5,0)

Result: 3

Tunde is the third item in the selected range.

7. Combining INDEX and MATCH

INDEX and MATCH can work together to find information in a spreadsheet.

MATCH finds the position of the information you are searching for, while INDEX returns the related value from another range.

Example: Finding a Student's Score

Assume student IDs are stored in A2:A5 and examination scores are stored in D2:D5.

To find the examination score of ST003, enter:

=INDEX(D2:D5,MATCH("ST003",A2:A5,0))

Result: 65

MATCH first finds the position of ST003. INDEX then uses that position to return the score from the corresponding location in the score range.

8. Difference Between VLOOKUP, HLOOKUP, and XLOOKUP

Function How It Searches Best Use
VLOOKUP Searches vertically down the first column. Finding information in vertically arranged tables.
HLOOKUP Searches horizontally across the first row. Finding information in horizontally arranged tables.
XLOOKUP Searches a selected range and returns a value from another range. Flexible searches in modern Excel versions.
INDEX Returns a value from a specified position. Retrieving information from a selected range.
MATCH Finds the position of a matching value. Locating the position of an item in a range.

9. Common Lookup Errors and How to Avoid Them

  • #N/A: Excel cannot find the requested value. Check the search value and selected range.
  • #REF!: A formula refers to an invalid cell or column position.
  • #VALUE!: A formula contains an incorrect type of value or argument.
  • Wrong result: Check the column or row number in your formula.
  • Unexpected match: Use FALSE in VLOOKUP or 0 in MATCH when you need an exact match.

Also check for extra spaces and inconsistent data formats. For example, a student ID stored as text may not match the same-looking value stored as a number.

10. Practical Exercise

A computer training centre in Nigeria has created a spreadsheet containing information about its students.

Student ID Name Course Score
CRM001AdeExcel85
CRM002MaryPower BI90
CRM003JohnData Analysis75
CRM004GraceCybersecurity95
CRM005PeterExcel80

Your Tasks

  1. Use VLOOKUP to find the score of student CRM002.
  2. Use VLOOKUP to find the course studied by CRM004.
  3. Arrange some sample information horizontally and use HLOOKUP to find a value.
  4. Use XLOOKUP to find the name of student CRM003.
  5. Use INDEX to retrieve the third student name.
  6. Use MATCH to find the position of CRM005.
  7. Combine INDEX and MATCH to find the score of CRM001.

Module Summary

In this module, you learned how to find and retrieve information from Excel spreadsheets using lookup and reference functions.

  • VLOOKUP: Searches vertically down a table.
  • HLOOKUP: Searches horizontally across a table.
  • XLOOKUP: Provides a flexible way to search for information.
  • INDEX: Returns a value from a specific position.
  • MATCH: Finds the position of a value in a range.
  • INDEX and MATCH: Work together to find related information.

These functions are useful when working with school databases, employee records, customer information, product lists, and business reports.

What Is Next?

In Module 8, you will learn about Statistical and Conditional Calculation Functions in Excel. You will discover how to calculate averages, count records based on conditions, and analyse data using functions such as AVERAGEIF, AVERAGEIFS, SUMIF, and SUMIFS.

๐Ÿ† Get Certified

๐Ÿ”’

Earn this certificate

Every lesson is already free to read. Sign up, finish the lessons, pass the exam (โ‚ฆ2,000 or 20,000 coins), and get a verified certificate with your name on it.

๐ŸŽ“ Sign Up to Get Certified
๐Ÿ› ๏ธ Practice Tools
Hands-on simulators & labs - subscription required.
โ†’
๐ŸŽฏ Internship Tasks
Real-world tasks to build your portfolio - unlock them with a subscription.
โ†’