ADVANCED COURSES ARE LIVE !!! HURRY UP JOIN NOW

How to Use Excel’s INDEX and AGGREGATE Functions to Find the K-th Smallest or Largest Value in a Range

INDEX and AGGREGATE Functions

Have you ever tried to find the 2nd highest score in a spreadsheet, or maybe the 3rd smallest sale amount from a messy list of data? That’s where mastering INDEX and AGGREGATE Functions becomes incredibly powerful. By combining INDEX Functions with AGGREGATE Functions, Excel lets you build dynamic, clean, and flexible formulas to retrieve k-th smallest or largest values—even from error-filled or filtered datasets. These advanced techniques are a core part of any advanced Excel and Powerbi course and are taught in detail at a professional advance Excel institute, helping you move beyond basic formulas into true spreadsheet wizardry.

In this post, you’ll learn exactly how to do that using real-life examples, highlighted formulas, and step-by-step guidance — making it perfect for anyone enrolling in an advanced Excel and Powerbi course or learning at a trusted advance Excel institute, even if you’re not an Excel nerd (yet).

INDEX and AGGREGATE Functions 
INDEX Functions 
AGGREGATE Functions 
advanced excel and powerbi course 
advance excel institute

🧠 First: What Are INDEX and AGGREGATE?

✅ INDEX

Returns value at a specific position.

=INDEX(A1:A10, 3)

Returns 3rd value.

✅ AGGREGATE

Super-powered calculation that ignores errors.

=AGGREGATE(15, 6, A1:A10, 2)

15=SMALL, 6=Ignore Errors.

💥 The Real Power: INDEX + AGGREGATE Combo

What if you want the actual row or related data of the k-th smallest value (like the name of the salesperson with the 2nd highest sale)? That’s where INDEX wraps around AGGREGATE.

=INDEX(Range, AGGREGATE(15, 6, Relative_Row_Math, k))

📊 Real-Life Example: Ranking Sales Reps by Sales

Imagine you manage a small sales team. Your goal is to find the name of the person with the 2nd highest sales figure.

NameSales
Sarah1200
Jamal2300
Amina900
Derek2300
Lucia1500

🔽 Step 1: Get the 2nd Largest Sale

=AGGREGATE(14, 6, B2:B6, 2)

14 = LARGE. Result is 2300.

👀 Step 2: Find the Row

=AGGREGATE(15, 6, (B2:B6=2300)*(ROW(B2:B6)-ROW(B2)+1), 1)

Result: 2 (Jamal’s relative position).

🏆 Step 3: Wrap in INDEX

=INDEX(A2:A6, [Result from Step 2])

Result: “Jamal”.

🧠 What About Finding the K-th Smallest Value?

Same structure, but swap AGGREGATE(14,…) → AGGREGATE(15,…).

=INDEX(A2:A6, AGGREGATE(15, 6, (B2:B6=AGGREGATE(15,6,B2:B6,k))*(ROW(B2:B6)-ROW(B2)+1), 1))

This retrieves the first person who got the k-th smallest sale.

⚙️ Make It Dynamic with Cell References

Instead of hardcoding k = 2, reference a cell:

=INDEX(A2:A6, AGGREGATE(15, 6, (B2:B6=AGGREGATE(14,6,B2:B6,E1))*(ROW(B2:B6)-ROW(B2)+1), 1))

Assuming cell E1 holds the rank you want (e.g. 2 for 2nd largest).

🛡️ Pro Tips & Use Cases

Use in dashboards – Create live leaderboards where k can be changed via dropdown.

Avoid array formulas in older Excel? Use AGGREGATE instead of SMALL/LARGE inside INDEX/MATCH.

Handle duplicates gracefully — AGGREGATE always returns the first match, great for stable reporting.

Filter-safe – With right options (6, 7, 5), AGGREGATE can ignore hidden rows or errors.

🧮 Use Case: Get the Name of the Salesperson with the 3rd Lowest Non-Error Value

Let’s say column B has errors:

=INDEX(A2:A10, AGGREGATE(15, 6, (ISNUMBER(B2:B10)*(ROW(B2:B10)-ROW(B2)+1)), 3))

🧠 Wrapping Up: When Should You Use INDEX + AGGREGATE?

✅ When you want flexibility and clarity
✅ When LARGE, SMALL, MATCH get messy with errors
✅ When building reports, dashboards, or anything user-friendly

This combo formula is lean, powerful, and battle-tested for real-world data tasks.

💬 TL;DR – The Golden Formula

Want to return the name of the person who got the k-th largest sale?

=INDEX(NameRange, AGGREGATE(15, 6, (SalesRange=LARGE(SalesRange, k))*(ROW(SalesRange)-MIN(ROW(SalesRange))+1), 1))

Plug in your own ranges and k-value. You’ve got Excel muscle now.
INDEX Functions AGGREGATE Functions

Find Our Locations

Visit any of our three convenient branches or contact us directly.

Citylight Branch

Address: G-40, Navmangalam Complex, Citylight.

Phone: +91-9825771678

View on Map

Vesu Branch

Address: G-48, J9 High Street, Canal Road, Vesu.

Phone: +91-9825771641

View on Map

Pal Branch

Address: 115, Raj Victoria Complex, Pal Gam Circle, Pal.

Phone: +91-9825771641

View on Map

Turn Negatives Into Productivity!

Master functions like ABS, MOD, and Pivot Tables with our specialized

courses in Advanced Excel and Data Science.

Tags:

Share:

You May Also Like

Your Website WhatsApp