Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Solving Real Lookup Problems | Advanced Lookup Systems and Relational Modeling
Excel Formulas

Solving Real Lookup Problems

Swipe to show menu

Exact matches are useful for relational models, but many business systems rely on ranges and thresholds instead of fixed values. In this chapter, use approximate matching to build tier-based pricing logic and dynamic discount calculations.

Approximate Match with XLOOKUP

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], -1)
  • lookup_value: value being evaluated;
  • lookup_array: threshold values;
  • return_array: returned result;
  • -1: returns the largest value less than or equal to the lookup value.

Approximate matching requires the lookup array to be sorted in ascending order.

Tier-Based Logic

Tier tables define minimum thresholds instead of exact matches.

Example:

Min_UnitsDiscount_Rate
10%
55%
1010%
2015%

Excel evaluates where the Units value fits inside the threshold structure and returns the corresponding discount rate.

Step 1 Create the Pricing Tiers Table
expand arrow

Create a new worksheet named:

Pricing_Tiers

Add the following dataset:

Min_Units;Discount_Rate
1;0%
5;5%
10;10%
20;15%

Convert the dataset into an Excel Table.

Confirm that Min_Units is sorted in ascending order.

Step 2 Build the Discount Lookup
expand arrow

Inside Sales_Data, create a new column named:

Discount_Rate

Inside the first row, type:

=XLOOKUP([@Units],Pricing_Tiers[Min_Units],Pricing_Tiers[Discount_Rate],0,-1)
  • [@Units]: current row Units value;
  • Pricing_Tiers[Min_Units]: threshold column;
  • Pricing_Tiers[Discount_Rate]: returned discount value;
  • 0: fallback value;
  • -1: approximate match mode.

Format the results as percentages.

Step 3 Build Discounted Revenue
expand arrow

Create a new column named:

Discounted_Revenue

Inside the first row, type:

=[@Revenue]*(1-[@Discount_Rate])
  • [@Revenue]: original Revenue value;
  • [@Discount_Rate]: applied discount percentage.

The calculation now adjusts dynamically based on unit volume.

Step 4 Test Dynamic Tier Updates
expand arrow

Modify the values inside Pricing_Tiers.

Confirm that all dependent calculations update automatically.

Step 5 Update the Top Product Logic
expand arrow

Replace the previous top product formula with:

=XLOOKUP(MAX(Sales_Data[Discounted_Revenue]),Sales_Data[Discounted_Revenue],Sales_Data[Product],"Not found")

The lookup now evaluates discounted performance instead of raw Revenue.

Step 6 Build a Reverse Lookup Section
expand arrow

Inside the Summary sheet, create an input section for:

Order_ID
Step 7 Retrieve Customer Information
expand arrow

Inside the lookup result cell, type:

=XLOOKUP(M2,Sales_Data[Order_ID],Sales_Data[Customer_ID],"Not found")
  • M2: Order_ID input;
  • Sales_Data[Order_ID]: lookup column;
  • Sales_Data[Customer_ID]: returned value.
Step 8 Retrieve Product Information
expand arrow

Inside another result cell, type:

=XLOOKUP(M2,Sales_Data[Order_ID],Sales_Data[Product],"Not found")

The formulas now retrieve transaction details dynamically from the selected Order_ID.

Step 9 Test Dynamic Lookups
expand arrow

Change the value inside M2.

Confirm that:

  • Customer values update automatically;
  • Product values update automatically;
  • The formulas always return the matching transaction.

1. What does match_mode = -1 do in XLOOKUP?

2. Why must the lookup array be sorted when using approximate match?

3. What makes XLOOKUP suitable for reverse lookups?

question mark

What does match_mode = -1 do in XLOOKUP?

Select the correct answer

question mark

Why must the lookup array be sorted when using approximate match?

Select the correct answer

question mark

What makes XLOOKUP suitable for reverse lookups?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 3

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Section 3. Chapter 3
some-alt