0Pricing
Excel Formulas Academy · Lesson

Searching Left and From the Bottom

Look up in any direction including right-to-left and last-to-first.

Searching Left and From the Bottom is a free Excel Formulas Academy lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Excel Formulas Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Direction Freedom

One of VLOOKUP's biggest limits was that it could only return values to the right of the lookup column. XLOOKUP has no such rule.

Because you supply the lookup array and return array separately, the answer can be anywhere - left, right, above, or below the column you search.

=XLOOKUP(D2, B2:B20, A2:A20)

Looking Up to the Left

Suppose IDs are in column B and names are in column A, to the left. VLOOKUP could not do this without rearranging columns.

With XLOOKUP you simply search column B and return column A. The function happily returns a value that sits left of the lookup column.

=XLOOKUP(D2, B2:B20, A2:A20)

The Fifth Argument: search_mode

XLOOKUP has an optional fifth argument, search_mode, that controls the direction of the search.

  • 1 - search first to last (the default)
  • -1 - search last to first
  • 2 - binary search on ascending data
  • -2 - binary search on descending data
=XLOOKUP(lookup_value, lookup_array, return_array, if_not_found, match_mode, search_mode)

Default Search Direction

By default XLOOKUP searches from the top down, returning the first match it encounters.

If a value appears several times in your list, this default gives you the earliest one. That is fine most of the time, but sometimes you want the most recent entry instead.

=XLOOKUP(D2, A2:A20, B2:B20)

Searching From the Bottom

Set search_mode to -1 to search from the bottom up. XLOOKUP then returns the last matching value.

Because if_not_found and match_mode come before search_mode, you must include the earlier arguments as placeholders, even if they are empty.

=XLOOKUP(D2, A2:A20, B2:B20, "Not found", 0, -1)

Why Last Match Matters

Imagine a log where each row records a status update for an order, oldest at the top.

Searching top-down gives the order's first status. Searching bottom-up with -1 gives its latest status. The same data, two very different answers depending on direction.

=XLOOKUP(D2, OrderID, Status, "No record", 0, -1)

Filling the Placeholders

Arguments are positional, so you cannot skip to the sixth one without naming the ones before it.

In =XLOOKUP(D2, A2:A20, B2:B20, "Not found", 0, -1) the "Not found" is if_not_found and the 0 is match_mode (exact match). These hold the slots so -1 lands in search_mode.

=XLOOKUP(D2, A2:A20, B2:B20, "Not found", 0, -1)

match_mode in Brief

The fifth argument's neighbor, match_mode, controls how matching works:

  • 0 - exact match (default)
  • -1 - exact or next smaller
  • 1 - exact or next larger
  • 2 - wildcard match using * and ?

For left and bottom searches you usually keep this at 0.

=XLOOKUP(D2, A2:A20, B2:B20, "Not found", 0, -1)

A Worked Bottom-Up Example

A price-change sheet lists each product every time its price updates. To get the current price you want the last entry for that product.

Searching from the bottom with -1 returns the most recent price without sorting or extra helper columns.

=XLOOKUP("Laptop", A2:A500, B2:B500, "No price", 0, -1)

Binary Search for Speed

Search modes 2 and -2 use a faster binary search, but they require the lookup array to be sorted - ascending for 2, descending for -2.

On huge sorted lists this is much quicker. If the data is not truly sorted, binary search can return wrong results, so use it carefully.

=XLOOKUP(D2, A2:A100000, B2:B100000, "Not found", 0, 2)

Putting Direction to Work

You now control both where and which way XLOOKUP searches:

  • Return values from the left freely
  • 1 for first match (default)
  • -1 for last match
  • 2 or -2 for fast binary search on sorted data

Remember to fill the if_not_found and match_mode slots before search_mode.

=XLOOKUP(D2, A2:A20, B2:B20, "Not found", 0, -1)

Quick Check

Test your understanding of the search_mode argument.

Recap: Any Direction

You learned XLOOKUP's directional power:

  • Return arrays can sit to the left of the lookup array
  • search_mode (the 6th argument) sets direction
  • -1 finds the last match, ideal for latest-record lookups
  • 2 and -2 enable fast binary search on sorted data

Next you will return entire rows or columns from a single XLOOKUP.

=XLOOKUP(D2, A2:A20, B2:B20, "Not found", 0, -1)

Frequently asked questions

Is the “Searching Left and From the Bottom” lesson free?

Yes — the full text of “Searching Left and From the Bottom” is free to read here on the web, and the Excel Formulas Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Excel Formulas Academy course, upgrade to CoddyKit PRO.

What will I learn in “Searching Left and From the Bottom”?

Look up in any direction including right-to-left and last-to-first. You practise Excel Formulas Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Excel Formulas Academy?

No prior experience is required. Excel Formulas Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Searching Left and From the Bottom” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Excel Formulas Academy lesson?

Yes. Every Excel Formulas Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. The XLOOKUP Syntax
  2. Handling Misses With if_not_found
  3. Searching Left and From the Bottom
  4. Returning Whole Rows or Columns
← Back to Excel Formulas Academy