How to Lookup Value Between Two Numbers in Excel
Learn multiple Excel methods to lookup value between two numbers with step-by-step examples and practical applications.
How to Lookup Value Between Two Numbers in Excel
Why This Task Matters in Excel
Imagine preparing a commission report where sales staff earn different commission rates depending on their revenue band, or producing a tax calculator that pulls the correct tax rate based on income brackets. These are classic “lookup between two numbers” problems: you have a continuous scale (revenue, income, temperature, age, mileage) that must be mapped to a discrete category (commission rate, tax band, maintenance interval, risk level).
In business intelligence, pricing analysis, human-resources grading, logistics, and countless other domains, classifying a numeric input into the correct bucket is fundamental. Without a quick, reliable way to do it you risk manual errors, inconsistent logic, and enormous time drains whenever the lookup table changes. Automating the process with a well-built Excel model lets you:
- Adapt instantly when band thresholds change
- Scale from a few lines to thousands of rows without additional effort
- Audit and maintain the logic in a single place rather than scattering IF statements around the workbook
- Integrate with dashboards, PivotTables, Power Query, and external data feeds
Excel is perfectly suited to this task because its lookup functions are optimized for ordered lists; a single formula can return the correct result for any input as long as the thresholds are sorted. Neglecting to master this technique forces users into repetitive manual categorization or massive nested IFs, both of which break easily and are almost impossible to debug. Understanding lookups between two numbers also deepens your overall Excel skill set: it reinforces sorting requirements, approximate-match logic, error handling, and dynamic ranges—concepts that recur in advanced modeling, KPI dashboards, and modern dynamic array functions.
Best Excel Approach
The most efficient modern technique is XLOOKUP with an approximate match. It is fast, flexible, and avoids many legacy VLOOKUP limitations (such as mandatory left-to-right layout). XLOOKUP’s optional parameters let you specify that if an exact match is not found, the function should return the next smaller item—ideal for threshold tables.
When to use:
- Excel 365 and Excel 2021 users should default to XLOOKUP.
- If you must support older versions, fall back to INDEX/MATCH with approximate match or to VLOOKUP.
Prerequisites:
- A threshold column sorted in ascending order (lower limit to higher limit).
- A return column (rate, category, label, etc.) aligned row-for-row with the thresholds.
Logic overview:
- Provide the input value (the number you want to classify).
- Ask XLOOKUP to find that value in the threshold column.
- Tell Excel to return the associated result from the return column.
- Use match_mode −1 so Excel selects the next smaller value if no exact match is found.
Syntax:
=XLOOKUP(input_value, threshold_column, result_column, "Not found", -1)
- input_value – cell with the number you are classifying
- threshold_column – sorted column containing the lower bounds of each band
- result_column – column containing the result you want returned
- \"Not found\" – optional message for out-of-range inputs
- −1 – instructs XLOOKUP to return the next smaller item on no exact match
Alternative classic approach:
=INDEX(result_column, MATCH(input_value, threshold_column, 1))
MATCH with 1 acts just like XLOOKUP’s −1 mode but requires threshold_column to be first.
Parameters and Inputs
Threshold column: A numeric range such as [B2:B8] listing the lower limits of each band. Must be sorted ascending; duplicates are allowed only if they represent identical bands.
Result column: A range like [C2:C8] of the same height as the threshold column, containing text, numbers, or formulas. Can be to the left or right of the threshold if using XLOOKUP; with VLOOKUP it must be to the right.
Input_value: Typically a single cell such as [E2] holding the number you wish to classify. This can be a hard-coded value, a formula result, or even another lookup.
Optional parameters:
- If you supply a “not found” message or 0 (zero), you can control what happens when input_value is lower than the first threshold or if the list is empty.
- With INDEX/MATCH or VLOOKUP you will need IFERROR or IFNA wrappers to manage such out-of-range cases.
Data preparation: Ensure numeric inputs are truly numeric (no stray spaces) and that thresholds cover the full expected range including minimums. Validate with Data Validation to prevent users from entering text where a number is required.
Edge cases:
- Negative numbers when thresholds start at zero
- Extremely large numbers beyond the last threshold—XLOOKUP will return the last band, which may or may not be what you want.
- Missing or blank cells in the threshold list can break approximate matches; always populate every row.
Step-by-Step Examples
Example 1: Basic Scenario – Commission Rate Lookup
Suppose you pay sales commissions based on revenue:
| B | C |
|---|---|
| Threshold | Commission Rate |
| 0 | 2% |
| 5000 | 4% |
| 10000 | 6% |
| 20000 | 8% |
Step 1 – Enter thresholds [B2:B5] exactly as above.
Step 2 – Enter rates [C2:C5] (format as Percentage).
Step 3 – In cell [E2] type a sales amount, for example 7 250.
Step 4 – In [F2] enter:
=XLOOKUP(E2, B2:B5, C2:C5, "Out of band", -1)
Result: 4 % because 7 250 falls between 5 000 and 10 000.
Why it works: XLOOKUP looks for 7 250. No exact match exists, so with match_mode −1 it slides up the list until it finds the largest number less than or equal to 7 250, which is 5 000, and returns the aligned rate.
Variations:
- Add a maximum cap by appending a final threshold (say 50 000) with a rate of 10 %.
- Swap in INDEX/MATCH to support older workbooks:
=INDEX(C2:C5, MATCH(E2, B2:B5, 1))
Troubleshooting tip: If you see #N/A, the input is smaller than the first threshold. Insert an IFERROR wrapper or extend the threshold list down to zero.
Example 2: Real-World Application – Insurance Premium Rating
You are an underwriter calculating motor insurance premiums based on driver age. The younger the driver, the higher the risk surcharge.
Table in [B2:D9]:
| B | C | D |
|---|---|---|
| Age Minimum | Base Rate | Surcharge |
| 17 | 600 | 0.35 |
| 21 | 480 | 0.22 |
| 30 | 420 | 0.15 |
| 40 | 390 | 0.08 |
| 55 | 350 | 0.00 |
| 70 | 400 | 0.18 |
| 80 | 500 | 0.30 |
The table contains both a base rate and a percentage surcharge. A driver aged 33 should pick the row starting at 30.
Step 1 – Sort Age Minimum ascending (already done).
Step 2 – Input driver age in [F2].
Step 3 – Return row number of correct band:
=XMATCH(F2, B2:B9, -1)
Note: XMATCH is optional; we will embed its logic inside INDEX/XLOOKUP next.
Step 4 – Retrieve base rate:
=XLOOKUP(F2, B2:B9, C2:C9, , -1)
Step 5 – Retrieve surcharge:
=XLOOKUP(F2, B2:B9, D2:D9, , -1)
Step 6 – Combine premium calculation in [H2]:
=G2 * (1 + H2)
(where G2 is the base rate result, H2 the surcharge).
Business context: This single model returns a dynamic premium for any driver age, fully transparent for compliance review. To update premiums next year, the actuary edits only the table—formulas automatically adjust.
Integration:
- Use Data Validation to restrict age inputs to 17 – 99.
- Build a What-If Analysis with a data table to project premiums across ages 17 – 90.
- Feed the table into a Power Pivot data model to analyze underwriting profitability.
Performance: On a few thousand policies the formulas recalculate instantly. For multi-hundred-thousand quote simulations, favor INDEX/MATCH because it has slightly lower overhead than repeatedly calling XLOOKUP, or use Power Query to merge tables before import.
Example 3: Advanced Technique – Band Lookup with Dynamic Array Spill
Scenario: You manage a service-level-agreement (SLA) dashboard with hundreds of response times in [A2:A201] and want to assign color-coded SLA categories in bulk.
Threshold table in [E2:F5]:
| E | F |
|---|---|
| Response Time ≤ | SLA Category |
| 30 | Gold |
| 60 | Silver |
| 120 | Bronze |
| 9999 | Breach |
Unlike previous examples, the thresholds here represent “upper limits.” We will invert the usual approach: sort ascending and tell Excel to find the first threshold greater than or equal to the response time.
Step 1 – Sort threshold list ascending (already is).
Step 2 – In [B2] enter a single formula that spills down:
=MAP(A2:A201, LAMBDA(t, XLOOKUP(t, E2:E5, F2:F5, "No SLA", 1, 1)))
Explanation:
- MAP iterates over each cell t in [A2:A201].
- For each t it performs an XLOOKUP.
- match_mode 1 asks for the next larger item, perfect for “upper limit” bands.
- search_mode 1 forces binary search for speed.
Advanced benefits:
- One formula, no manual fills—spill handles any added rows automatically.
- LAMBDA keeps the worksheet readable; you could define a named LAMBDA function like SLA_CATEGORY() and reuse it across reports.
- Binary search search_mode improves performance on large datasets (Excel 365 only).
Error handling: The “No SLA” placeholder catches negative or extremely large response times. Wrap the entire MAP in TOCOL or TAKE functions if you need to pass results into other dynamic array operations.
Professional tip: Use Conditional Formatting referencing the spilled categories to color response times Live.
Tips and Best Practices
- Always sort your threshold column ascending. Approximate matches depend on order; unsorted lists produce random or #N/A results.
- Keep threshold and result columns adjacent and inside a structured Excel Table so the range expands automatically when you add new bands.
- Replace hard-coded inputs with named ranges (e.g., nIncome) to make formulas self-documenting and easier to audit.
- Use IFERROR or XLOOKUP’s optional “not found” argument to catch values outside the expected range and display user-friendly messages.
- For heavy workloads, calculate the MATCH index once and re-use it with INDEX on multiple result columns to save processing time.
- Document your bands with comments or a dedicated “Assumptions” sheet so future users understand the business logic.
Common Mistakes to Avoid
- Threshold list not sorted: The most frequent error; approximate match functions silently return wrong rows. Confirm with conditional formatting that [B2:B8] is ascending.
- Using TRUE in VLOOKUP but keeping exact-match thinking: Users expect exact matches and do not realize values between thresholds pick the previous row—test with outlier inputs to validate behavior.
- Forgetting to expand the threshold list after adding a new band: Named tables fix this; without them the formula still references the old range.
- Mixing text and numbers in the threshold column: “10000 ” (with trailing space) is text; Excel treats it differently from 10000. Run VALUE() or TRIM() to clean inputs.
- Disallowing negative or zero thresholds while the data contains them: Income or temperature may go negative; define lower-bound business rules and communicate them to users.
Alternative Methods
| Method | Pros | Cons | Version Support |
|---|---|---|---|
| XLOOKUP (approximate) | Flexible column order, built-in not-found argument, handles vertical and horizontal lists | Only Excel 365 / 2021 | Modern only |
| INDEX + MATCH (1) | Works 2007+, faster than multiple XLOOKUP calls, column-order agnostic | Slightly longer syntax, separate error handling | All modern versions |
| VLOOKUP (TRUE) | Familiar to many users, single function | Requires threshold in left-most column, breaks on column insertions, slower on wide tables | All versions |
| LOOKUP | Very short, auto approximate, horizontal or vertical | No error handling, legacy, can misfire on text | All versions |
| Nested IFs | No lookup table needed | Hard to maintain, prone to errors, complexity explosion with many bands | All versions |
When to use:
- Use XLOOKUP when every collaborator has Excel 365.
- Use INDEX/MATCH for mixed environments or performance-critical models with multiple return columns.
- Use VLOOKUP only for quick ad-hoc workbooks where table design constraints fit its limitations.
FAQ
When should I use this approach?
Use lookup-between-two-numbers formulas whenever you have numeric data that maps to discontinuous rates or categories: tax tables, commission schemes, shipping fees by weight, conditional formatting gradients, or safety thresholds—any time the rule can be described as “If value is at least X and less than Y, then…”.
Can this work across multiple sheets?
Yes. Point the threshold_column and result_column arguments to another worksheet, e.g. ‘Rates’!B2:B10. Keep entire bands in a dedicated “Parameters” sheet to centralize logic. Use named ranges or structured tables to avoid broken links when you expand the lists.
What are the limitations?
Approximate matches extrapolate only downward (or upward with match_mode 1). Inputs below the minimum threshold produce #N/A unless you trap them. If your bands involve both lower and upper limits that change independently (non-continuous coverage) you may need a two-dimensional lookup instead.
How do I handle errors?
Add the optional “not found” argument in XLOOKUP, or wrap VLOOKUP/INDEX/MATCH in IFERROR:
=IFERROR(INDEX(C2:C8, MATCH(E2, B2:B8, 1)), "Below minimum")
Alternatively, pre-validate the input with Data Validation (“decimal between 0 and 1 000 000”) to intercept invalid values before they reach the formula.
Does this work in older Excel versions?
INDEX/MATCH and VLOOKUP approaches work back to Excel 2007. LOOKUP even works in Excel 2003. XLOOKUP, XMATCH, MAP, and LAMBDA require Microsoft 365 or Excel 2021.
What about performance with large datasets?
For tens of thousands of rows, INDEX/MATCH is slightly faster than repeated XLOOKUP calls. Cache the MATCH result if you need multiple columns from the same band. For hundreds of thousands to millions of rows, offload to Power Query or Power Pivot and perform the band join there, or use Dynamic Arrays sparingly and calculate on demand.
Conclusion
Mastering lookups between two numbers equips you with a versatile skill that underpins commission calculators, tax tables, risk scoring models, and countless other real-world solutions. Whether you choose modern XLOOKUP, reliable INDEX/MATCH, or familiar VLOOKUP, the core concept—sorted thresholds feeding an approximate match—remains the same. Implement these techniques, practice on sample datasets, and soon you’ll classify any numeric input with confidence, accuracy, and speed. Next, explore dynamic array functions and Power Query merges to push your lookup skills even further into enterprise-scale analytics.
Related Articles
How to Show the 10 Most Common Text Values in Excel
Learn multiple Excel methods to list the 10 most frequent text values—complete with step-by-step examples, business use cases, and expert tips.
How to Abbreviate Names Or Words in Excel
Learn multiple Excel methods to abbreviate names or words with step-by-step examples and practical applications.
How to Abbreviate State Names in Excel
Learn multiple Excel methods to abbreviate state names with step-by-step examples, professional tips, and real-world applications.