VLOOKUP Maximum and Minimum: Threshold Matching and Category-Based Max/Min

VLOOKUP Maximum and Minimum: Threshold Matching and Category-Based Max/Min

Solve VLOOKUP maximum minimum problems in 10 seconds. For the maximum (≤) at or below a threshold, use VLOOKUP (approximate match); for the minimum (≥) at or above a threshold, use XLOOKUP or INDEX+MATCH(-1). For category-based maximum/minimum values and returning related values (such as item names), use MAXIFS/MINIFS + XMATCH.

Quick Fix

  • Maximum ≤ (Column A sorted ascending):
    =VLOOKUP(H2, A2:C100, 3, TRUE)
  • Minimum ≥ (no sorting required; recommended):
    =XLOOKUP(H2, A2:A100, C2:C100, , 1)
  • Maximum value by category:
    =MAXIFS(C2:C100, A2:A100, K2)
  • Item for that value:
    =LET(m,MAXIFS(C2:C100,A2:A100,K2), INDEX(B2:B100, XMATCH(1,(A2:A100=K2)*(C2:C100=m))))

Concept: VLOOKUP Approximate Match and Sorting

When the lookup column is sorted in ascending order, VLOOKUP’s TRUE approximate match selects the largest value that is ≤ the threshold. Conversely, to find the smallest value ≥ the threshold, use XLOOKUP with match_mode=1 or MATCH with -1 (with the lookup column sorted in descending order).

Practical Example ① Threshold Matching

A (Lookup Value)B (Grade)C (Benefit)
60Bronze1%
80Silver3%
95Gold5%
110Platinum7%
=VLOOKUP(97, A2:C5, 2, TRUE)   
=XLOOKUP(97, A2:A5, B2:B5, , 1)

Practical Example ② Category-Based Maximum/Minimum + Related Value

CategoryItemPrice
AAlpha12
AApex19
BBeta18
BBolt18
BBrave22
=MAXIFS(C2:C6, A2:A6, F2)
=LET(m,MAXIFS(C2:C6,A2:A6,F2), INDEX(B2:B6, XMATCH(1,(A2:A6=F2)*(C2:C6=m))))

Return all ties (Microsoft 365):

=FILTER(B2:B6, (A2:A6=F2)*(C2:C6=MAXIFS(C2:C6, A2:A6, F2)))

Alternatives and Extensions

  • XLOOKUP: Use match_mode ±1 and search_mode ±1 to control the first or last match.
  • INDEX+MATCH/XMATCH: Use the sort direction to adapt for ≥ or ≤ matching.
  • FILTER·SORTBY: Handle top N results and ties.

Checklist & Notes

  • VLOOKUP(...,TRUE) requires the lookup column to be sorted in ascending order.
  • For the minimum ≥ value, use XLOOKUP(...,1) or MATCH(-1) with descending sort order.
  • To find the row from a category-based value, use MAXIFS/MINIFS + XMATCH/INDEX.
  • Decide how to handle ties: first, last, or all.
  • Clean up mixed numbers and text before calculating.

Troubleshooting

SymptomCauseSolution
Incorrect approximate-match resultNot sortedSort the lookup column in ascending order or switch to XLOOKUP.
Difficulty finding the minimum ≥ valueVLOOKUP structural limitationUse XLOOKUP with match_mode=1.
Which row is returned for ties?Duplicate maximum/minimum valuesUse XMATCH for the first match or FILTER to return all matches.
Match failsMixed numbers/text or spacesClean the data with TRIM·CLEAN.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *