Part 1. Introduce
📋 Definition
The LOOKUP function in Microsoft Excel is a powerful and versatile lookup and reference function that allows you to find a value in a specified range (lookup_array) and return a value from another corresponding field (result_array). It helps you search for a value and retrieve a related value from a different location within a table or range of data.
🎯 Purpose
The main purpose of the LOOKUP function is to perform approximate or exact matching of a lookup value within a data range and retrieve a corresponding value. It is beneficial for data analysis, retrieval, and calculations based on specific lookup criteria.
📜 Syntax & Arguments:
The syntax of the LOOKUP function is as follows:
LOOKUP(lookup_value, lookup_array, [result_array])
Arguments:
lookup_value
: The value that you want to search for within the lookup_array.lookup_array
: The range of cells that contains the values to be searched (it should be in ascending order for the approximate match).result_array
: The cells’ content with the values to be returned based on the lookup result. This argument is optional. If not provided, the function returns the closest match in the lookup_array.
🔙 Return Value:
The LOOKUP function returns the value corresponding to the matched lookup_value from the result_array.
💡 Remarks:
- If
lookup_value
is smaller than the smallest value in thelookup_array
, the LOOKUP function will return the #N/A error. - If
lookup_value
is larger than the most significant value in thelookup_array
, the LOOKUP function will return the last value in theresult_array
. - The
lookup_array
must be in ascending order for approximate matching to work correctly.
Part 2. Examples
Let’s illustrate the LOOKUP function with three simple examples using Microsoft Excel spreadsheets:
Example 1: Student Grades Lookup
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Grade | Min Score | Max Score | Score | Result |
2 | A | 90 | 100 | 85 | =LOOKUP(D2, $B$2:$B$6, $A$2:$A$6) |
3 | B | 80 | 89 | 92 | =LOOKUP(D3, $B$2:$B$6, $A$2:$A$6) |
4 | C | 70 | 79 | 78 | =LOOKUP(D4, $B$2:$B$6, $A$2:$A$6) |
Explanation: In this example, we have a table with grade letters in Column A, their minimum scores in Column B, and maximum scores in Column C. We want to determine the grade based on the score provided in Column D. The LOOKUP function is used to find the rate corresponding to the given score from B2:B6 (minimum scores) and returns the grade from A2:A6 (grade letters). For instance, the formula in E2 looks up the score (85) in the range D2 (85) and returns the corresponding grade “A.”
Result Table:
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Grade | Min Score | Max Score | Score | Result |
2 | A | 90 | 100 | 85 | A |
3 | B | 80 | 89 | 92 | A |
4 | C | 70 | 79 | 78 | B |
Example 2: Price Tier Lookup
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Tier | Min | Max | Price | Price Tier |
2 | Bronze | 0 | 500 | 250 | =LOOKUP(D2, $B$2:$B$4, $A$2:$A$4) |
3 | Silver | 501 | 1000 | 750 | =LOOKUP(D3, $B$2:$B$4, $A$2:$A$4) |
4 | Gold | 1001 | 1500 | 1250 | =LOOKUP(D4, $B$2:$B$4, $A$2:$A$4) |
Explanation: In this example, we have a table with price tiers in Column A, and their minimum and maximum price ranges in Columns B and C, respectively. We want to determine the price tier based on the price provided in Column D. The LOOKUP function is used to find the price tier that corresponds to the given price from the range B2:B4 (minimum prices) and returns the price tier from A2:A4 (price tiers). For instance, the formula in E2 looks up the price (250) in the range D2 (250) and returns the corresponding price tier, “Bronze.”
Result Table:
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Tier | Min | Max | Price | Price Tier |
2 | Bronze | 0 | 500 | 250 | Bronze |
3 | Silver | 501 | 1000 | 750 | Silver |
4 | Gold | 1001 | 1500 | 1250 | Gold |
Example 3: Product Availability Lookup
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Product | Qty | Status | Order Qty | Availability |
2 | Laptop | 50 | In Stock | 10 | =LOOKUP(D2, $B$2:$B$4, $C$2:$C$4) |
3 | Phone | 20 | Low Stock | 15 | =LOOKUP(D3, $B$2:$B$4, $C$2:$C$4) |
4 | Tablet | 5 | Out of Stock | 8 | =LOOKUP(D4, $B$2:$B$4, $C$2:$C$4) |
Explanation: In this example, we have a table with product names in Column A, their available quantities in Column B, and the availability status in Column C. We want to determine the availability status based on the order quantity provided in Column D. The LOOKUP function is used to find the availability status that corresponds to the given order quantity from the range B2:B4 (available quantities) and returns the status from C2:C4 (availability status). For instance, the formula in E2 looks up the order quantity (10) in the range D2 (10) and returns the corresponding availability status “In Stock.”
Result Table:
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Product | Qty | Status | Order Qty | Availability |
2 | Laptop | 50 | In Stock | 10 | In Stock |
3 | Phone | 20 | Low Stock | 15 | In Stock |
4 | Tablet | 5 | Out of Stock | 8 | Low Stock |
Example 4: Employee Bonus Calculation
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Name | Sales | Target | Bonus | Bonus Category |
2 | John | $2000 | $1500 | =(IF(B2 > C2, B2 * 0.05, 0)) | =LOOKUP(D2, $G$2:$H$4) |
3 | Sarah | $1800 | $2000 | =(IF(B3 > C3, B3 * 0.05, 0)) | =LOOKUP(D3, $G$2:$H$4) |
4 | Mike | $2500 | $3000 | =(IF(B4 > C4, B4 * 0.05, 0)) | =LOOKUP(D4, $G$2:$H$4) |
Explanation: In this example, we have a table with employee names in Column A, their sales performance in Column B, and their sales target in Column C. We want to calculate the bonus for each employee based on their sales performance compared to the target. If the sales are above the target, the employee receives compensation of 5% of their sales; otherwise, they receive no bonus. The IF function is used to check if the sales performance in Column B is above the target in Column C. The LOOKUP function then categorizes the bonus amount into different categories from the reference table in columns G and H. For instance, the formula in D2 checks if the sales ($2000) in B2 are above the target ($1500) in C2. As it is, the bonus is calculated as $2000 * 0.05 = $100. The LOOKUP function then looks up this bonus amount ($100) in E2 from the reference table $G$2:$H$4 and returns the bonus category “Above Target.”
Result Table:
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Name | Sales | Target | Bonus | Bonus Category |
2 | John | $2000 | $1500 | $100 | Above Target |
3 | Sarah | $1800 | $2000 | $0 | Below Target |
4 | Mike | $2500 | $3000 | $125 | Above Target |
Example 5: Exam Grading
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Name | Math | Science | Average | Grade |
2 | John | 85 | 90 | =AVERAGE(B2:C2) | =LOOKUP(D2, $G$2:$H$6) |
3 | Sarah | 78 | 85 | =AVERAGE(B3:C3) | =LOOKUP(D3, $G$2:$H$6) |
4 | Mike | 92 | 88 | =AVERAGE(B4:C4) | =LOOKUP(D4, $G$2:$H$6) |
Explanation: In this example, we have a table with student names in Column A and their Math (Column B) and Science (Column C) scores. We want to calculate the average score for each student and assign a grade based on the average score using a reference table in columns G and H. The AVERAGE function is used to find the average score for each student. The LOOKUP function then categorizes the average score into different grade levels from the reference table. For instance, the formula in D2 calculates the average score for John as (85 + 90) / 2 = 87.5. The LOOKUP function then looks up this average score (87.5) in E2 from the reference table $G$2:$H$6 and returns the corresponding grade “A.”
Result Table:
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Name | Math | Science | Average | Grade |
2 | John | 85 | 90 | 87.5 | A |
3 | Sarah | 78 | 85 | 81.5 | B |
4 | Mike | 92 | 88 | 90 | A |
Example 6: Discounted Price Calculation
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Item | Price | Discount | Discounted Price | Discount Level |
2 | Apple | $2.5 | 10% | =B2 * (1 – C2) | =LOOKUP(C2, $G$2:$H$4) |
3 | Banana | $1.8 | 5% | =B3 * (1 – C3) | =LOOKUP(C3, $G$2:$H$4) |
4 | Orange | $1.2 | 15% | =B4 * (1 – C4) | =LOOKUP(C4, $G$2:$H$4) |
Explanation: In this example, we have a table with item names in Column A, their original prices in Column B, and the discount percentage in Column C. We want to calculate the discounted price for each item based on the discount percentage. The calculation is done by subtracting the discount percentage from 1 and multiplying it by the original price. The LOOKUP function then categorizes the discount percentage into different discount levels from the reference table in columns G and H. For instance, the formula in D2 calculates the discounted price for Apple as $2.5 * (1 – 0.1) = $2.25. The LOOKUP function then looks up this discount percentage (10%) in E2 from the reference table $G$2:$H$4 and returns the discount level “10% Discount.”
Result Table:
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Item | Price | Discount | Discounted Price | Discount Level |
2 | Apple | $2.5 | 10% | $2.25 | 10% Discount |
3 | Banana | $1.8 | 5% | $1.71 | 5% Discount |
4 | Orange | $1.2 | 15% | $1.02 | 15% Discount |
Example 7: Inventory Management
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Product | Stock | Threshold | Status | Inventory Status |
2 | Apple | 100 | 50 | =(IF(B2 > C2, “In Stock”, “Low Stock”)) | =LOOKUP(D2, $G$2:$H$3) |
3 | Banana | 40 | 50 | =(IF(B3 > C3, “In Stock”, “Low Stock”)) | =LOOKUP(D3, $G$2:$H$3) |
4 | Orange | 60 | 50 | =(IF(B4 > C4, “In Stock”, “Low Stock”)) | =LOOKUP(D4, $G$2:$H$3) |
Explanation: In this example, we have a table with product names in Column A, their current stock levels in Column B, and the threshold stock level in Column C. We want to determine the status of each product’s inventory based on whether the stock level is above or below the threshold. The IF function checks if the stock level in Column B is above the threshold in Column C. If it is, the status is “In Stock”; otherwise, it is “Low Stock.” The LOOKUP function is then used to categorize the inventory status into different levels from the reference table in columns G and H. For instance, the formula in D2 checks if the stock level (100) in B2 is above the threshold (50) in C2. As it is, the status is “In Stock.” The LOOKUP function then looks up this status (“In Stock”) in E2 from the reference table $G$2:$H$3 and returns the inventory status “Sufficient Stock.”
Result Table:
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Product | Stock | Threshold | Status | Inventory Status |
2 | Apple | 100 | 50 | In Stock | Sufficient Stock |
3 | Banana | 40 | 50 | Low Stock | Low Stock |
4 | Orange | 60 | 50 | In Stock | Sufficient Stock |
Example 8: Expense Analysis
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Month | Jan | Feb | Total Expense | Expense Trend |
2 | Jan | $300 | $350 | =SUM(B2:C2) | =LOOKUP(D2, $G$2:$H$4) |
3 | Feb | $400 | $420 | =SUM(B3:C3) | =LOOKUP(D3, $G$2:$H$4) |
4 | Mar | $320 | $300 | =SUM(B4:C4) | =LOOKUP(D4, $G$2:$H$4) |
Explanation: In this example, we have a table with months in Column A, and the corresponding expenses for each month in Columns B and C. We want to calculate the total cost for each month using the SUM function. The LOOKUP function then categorizes the expense trend into different levels from the reference table in columns G and H. For instance, the formula in D2 calculates the total expense for January as $300 + $350 = $650. The LOOKUP function then looks up this total expense ($650) in E2 from the reference table $G$2:$H$4 and returns the expense trend “High Expense.”
Result Table:
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Month | Jan | Feb | Total Expense | Expense Trend |
2 | Jan | $300 | $350 | $650 | High Expense |
3 | Feb | $400 | $420 | $820 | High Expense |
4 | Mar | $320 | $300 | $620 | Medium Expense |
Example 9: Shipping Fees
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Item | Weight | Region | Shipping Fee | Shipping Class |
2 | Laptop | 2 kg | Domestic | =IF(C2=”Domestic”, VLOOKUP(B2, $G$2:$H$4, 2, TRUE), VLOOKUP(B2, $G$5:$H$7, 2, TRUE)) | =LOOKUP(D2, $K$2:$L$4) |
3 | Book | 0.5 kg | International | =IF(C3=”Domestic”, VLOOKUP(B3, $G$2:$H$4, 2, TRUE), VLOOKUP(B3, $G$5:$H$7, 2, TRUE)) | =LOOKUP(D3, $K$2:$L$4) |
4 | Phone | 0.3 kg | International | =IF(C4=”Domestic”, VLOOKUP(B4, $G$2:$H$4, 2, TRUE), VLOOKUP(B4, $G$5:$H$7, 2, TRUE)) | =LOOKUP(D4, $K$2:$L$4) |
Explanation: In this example, we have a table with item names in Column A, their weights in Column B, and the shipping regions in Column C (either “Domestic” or “International”). We want to calculate the shipping fee for each item based on its weight and shipping region using the VLOOKUP function. If the region is “Domestic,” the shipping fee is looked up from columns G and H in the reference table. Otherwise, if the region is “International,” the shipping fee is looked up from the reference table in columns G and H. The LOOKUP function then categorizes the shipping fee into different shipping classes from the reference table in columns K and L. For instance, the formula in D2 checks if the region (“Domestic”) is in C2. As it is, the shipping fee for the laptop (2 kg) is looked up in VLOOKUP from the reference table $G$2:$H$4 and returns the shipping fee of $20. The LOOKUP function then looks up this shipping fee ($20) in E2 from the reference table $K$2:$L$4 and returns the shipping class “Standard Domestic.”
Result Table:
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Item | Weight | Region | Shipping Fee | Shipping Class |
2 | Laptop | 2 kg | Domestic | $20 | Standard Domestic |
3 | Book | 0.5 kg | International | $10 | Economy International |
4 | Phone | 0.3 kg | International | $10 | Economy International |
Example 10: Sales Commission
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Name | Sales | Target | Commission | Commission Level |
2 | John | $1000 | $800 | =(IF(B2 > C2, B2 * 0.1, 0)) | =LOOKUP(D2, $G$2:$H$4) |
3 | Sarah | $1500 | $1200 | =(IF(B3 > C3, B3 * 0.1, 0)) | =LOOKUP(D3, $G$2:$H$4) |
4 | Mike | $800 | $1000 | =(IF(B4 > C4, B4 * 0.1, 0)) | =LOOKUP(D4, $G$2:$H$4) |
Explanation: In this example, we have a table with employee names in Column A, their sales in Column B, and their sales target in Column C. We want to calculate the commission for each employee based on their sales performance compared to the target. If the sales are above the target, the employee receives a commission of 10% of their sales; otherwise, they receive no commission. The IF function is used to check if the sales performance in Column B is above the target in Column C. The LOOKUP function then categorizes the commission amount into different commission levels from the reference table in columns G and H. For instance, the formula in D2 checks if the sales ($1000) in B2 are above the target ($800) in C2. As it is, the commission is calculated as $1000 * 0.1 = $100. The LOOKUP function then looks up this commission amount ($100) in E2 from the reference table $G$2:$H$4 and returns the commission level “10% Commission.”
Result Table:
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Name | Sales | Target | Commission | Commission Level |
2 | John | $1000 | $800 | $100 | 10% Commission |
3 | Sarah | $1500 | $1200 | $150 | 10% Commission |
4 | Mike | $800 | $1000 | $0 | No Commission |
Example 11: Test Scores
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Name | Math | Science | Total Score | Score Level |
2 | John | 80 | 85 | =SUM(B2:C2) | =LOOKUP(D2, $G$2:$H$4) |
3 | Sarah | 90 | 78 | =SUM(B3:C3) | =LOOKUP(D3, $G$2:$H$4) |
4 | Mike | 70 | 92 | =SUM(B4:C4) | =LOOKUP(D4, $G$2:$H$4) |
Explanation: In this example, we have a table with student names in Column A and their Math (Column B) and Science (Column C) scores. We want to calculate the total score for each student using the SUM function. The LOOKUP function then categorizes the entire score into different score levels from the reference table in columns G and H. For instance, the formula in D2 calculates the total score for John as 80 + 85 = 165. The LOOKUP function then looks up this total score (165) in E2 from the reference table $G$2:$H$4 and returns the corresponding score level “Above Average.”
Result Table:
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Name | Math | Science | Total Score | Score Level |
2 | John | 80 | 85 | 165 | Above Average |
3 | Sarah | 90 | 78 | 168 | Above Average |
4 | Mike | 70 | 92 | 162 | Above Average |
Example 12: Inventory Reorder Level
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Product | Stock | Reorder Level | Status | Reorder Status |
2 | Apple | 100 | 50 | =(IF(B2 <= C2, “Order”, “No Order”)) | =LOOKUP(D2, $G$2:$H$3) |
3 | Banana | 40 | 50 | =(IF(B3 <= C3, “Order”, “No Order”)) | =LOOKUP(D3, $G$2:$H$3) |
4 | Orange | 60 | 50 | =(IF(B4 <= C4, “Order”, “No Order”)) | =LOOKUP(D4, $G$2:$H$3) |
Explanation: In this example, we have a table with product names in Column A, their current stock levels in Column B, and the reorder level in Column C. We want to determine the reorder status for each product’s inventory based on whether the stock level is below or above the reorder level. The IF function checks if the stock level in Column B is below or equal to the reorder level in Column C. If it is, the status is “Order”; otherwise, it is “No Order.” The LOOKUP function is then used to categorize the reorder status into different levels from the reference table in columns G and H. For instance, the formula in D2 checks if the stock level (100) in B2 is below or equal to the reorder level (50) in C2. As it is, the status is “Order.” The LOOKUP function then looks up this status (“Order”) in E2 from the reference table $G$2:$H$3 and returns the reorder status “Reorder Required.”
Result Table:
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Product | Stock | Reorder Level | Status | Reorder Status |
2 | Apple | 100 | 50 | Order | Reorder Required |
3 | Banana | 40 | 50 | Order | Reorder Required |
4 | Orange | 60 | 50 | No Order | No Reorder |
Note: The formulas in these examples are provided for illustrative purposes and may require modification based on your specific Excel setup and data range. Ensure you reference the correct sheet names and cell ranges in your Excel spreadsheet.Â
Part 3. Tips and Tricks
- When using the LOOKUP function for exact matches, ensure that the
lookup_array
is sorted in ascending order to obtain accurate results. - If you are looking for approximate matches using the LOOKUP function, make sure that the
lookup_array
is in ascending order; otherwise, the results may not be as expected. - Consider using the VLOOKUP or HLOOKUP functions when searching for larger tables or matrices values. These functions are often more efficient for such scenarios.
- Combine the LOOKUP function with IF, SUM, or AVERAGE functions to perform more complex calculations and data manipulations.
- Always review the results returned by the LOOKUP function and verify that they match your expectations, especially when dealing with large datasets.