Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

XLOOKUP 2 Way Lookup Explained for Kids

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

A 2-way XLOOKUP is like a treasure map where you need two different clues to find one specific prize. Instead of just looking down a list of names, you look down the side for a name AND across the top for a category to find the exact spot where they meet. To do this, you simply put one XLOOKUP function inside another XLOOKUP function, which tells Excel to find the right row first and then find the right column within that row.

What You'll Need

  • A computer with Microsoft Excel (the version that has XLOOKUP).
  • A data table (a grid) with labels on the left side and labels across the top.
  • Two pieces of information you want to search for (like a person's name and a specific month).

Step-by-Step

  1. Set Up Your Treasure Map: Create a table. For this example, imagine you are tracking how many gold stars your friends earned each month. Put your friends' names in the first column (A2 to A5) and the months (January, February, March) in the top row (B1 to D1). Fill in the middle with the number of stars each person got.
  2. Create Your Search Boxes: Pick two empty cells away from your table. In one cell (let's say F1), type the name of the friend you are looking for. In another cell (F2), type the month you want to check. This makes it easy to change your search later without rewriting the whole formula.
  3. Start the First XLOOKUP (The Row Finder): Go to the cell where you want the answer to appear. Type =XLOOKUP(. Now, click on cell F1 (the friend's name). This tells Excel, "Go find this person."
  4. Tell Excel Where the Names Are: After the first comma, highlight the list of names in your table (A2 to A5). Now Excel knows where to look for the name.
  5. The Magic Trick (The Nested XLOOKUP): Usually, the third part of XLOOKUP is where you pick the answer column. But for a 2-way lookup, we don't want just one column; we want Excel to choose the column. So, instead of highlighting a column, type another XLOOKUP( right here.
  6. Start the Second XLOOKUP (The Column Finder): Inside this second XLOOKUP, click on cell F2 (the month). This tells Excel, "Now find this specific month."
  7. Tell Excel Where the Months Are: After the comma, highlight the top row of your table where the months are listed (B1 to D1).
  8. Pick the Data Area: For the final part of the second XLOOKUP, highlight the entire area where the numbers (the stars) are located (B2 to D5). This tells Excel, "Once you find the right month, look in this big block of numbers to find the answer."
  9. Close Your Parentheses: You opened two sets of parentheses, so you must close two. Type )) and press Enter.
  10. Test It Out: Change the name in F1 or the month in F2. You will see the number of stars change automatically!

Common Mistakes

One of the most common mistakes is forgetting to close both sets of parentheses. Because you put one function inside another, Excel needs to know exactly where the second one ends before it can finish the first one. If you only put one ), Excel will show an error message.

Another mistake is selecting the wrong range for the data area. If your names are in cells A2 to A5 and your months are in B1 to D1, your data area must be B2 to D5. If you accidentally include the names or the months inside the data area, Excel might get confused and give you a word instead of a number, or it might shift the answer by one cell, giving you the wrong person's stars.

Some people also try to use the old VLOOKUP for this. While VLOOKUP can do 2-way lookups using a MATCH function, it is much harder to understand. Sticking with XLOOKUP is better because it is more flexible and doesn't require you to count columns manually.

Tips

To make your search boxes even cooler, use Data Validation to create drop-down menus. Instead of typing the name or month and risking a typo, you can click a little arrow and pick the name from a list. To do this, go to the Data tab, click Data Validation, and choose "List," then select your names or months.

If you want your formula to look cleaner, you can use named ranges. Instead of highlighting A2:A5, you can name that group of cells "FriendsList." Then your formula would look like =XLOOKUP(F1, FriendsList, XLOOKUP(F2, MonthsList, StarData)). This makes the formula read almost like a sentence.

Always double-check your spelling. If you type "Janury" instead of "January" in your search box, XLOOKUP won't find it. You can add a "Not Found" message to your formula to help you. In the first XLOOKUP, after the second XLOOKUP is finished, add a comma and then "Check Spelling". Now, if Excel can't find the name, it will tell you to check your spelling instead of showing a scary #N/A error.

Troubleshooting

If you see a #N/A error, it usually means Excel cannot find the exact word you typed. First, check for extra spaces. If you typed "John " (with a space at the end) but the table says "John", Excel thinks they are different people. Use the TRIM function or manually delete extra spaces.

If you see a #VALUE! error, check your range sizes. The list of names must be the same height as the data area. If you have 4 names but highlighted 5 rows of data, the formula will break. Make sure the "Row Finder" range and the "Data Area" height match perfectly.

If the formula returns the wrong value (for example, it gives you February's stars when you asked for January), check your Column Finder range. Ensure the range you highlighted for the months starts exactly where the data area starts. If the months are in B1:D1, the data area must start in column B.

If the formula doesn't work at all and you get a message saying the function isn't recognized, you might be using an older version of Excel. XLOOKUP is only available in Microsoft 365 and Excel 2021 or newer. If you have an older version, you will have to use the INDEX and MATCH combination instead.

Frequently Asked Questions

Can I use this for things other than numbers?

Yes! You can use a 2-way XLOOKUP to find text, dates, or any other type of information. It works the same way regardless of what is inside the cells.

What happens if there are two people with the same name?

By default, XLOOKUP finds the first match it sees starting from the top. If you have two people named "Sam," it will always give you the stars for the first "Sam" in the list.

Do I have to put the names on the left?

No. One of the best things about XLOOKUP is that your search column can be anywhere—to the left or the right of your data. It doesn't matter as long as you highlight the correct ranges.

Can I search for three things at once?

Yes, you can! You can nest a third XLOOKUP inside the others if you have a 3D table (though this is rare in standard spreadsheets). Most people find that 2-way lookups are enough for almost any project.

Is XLOOKUP better than VLOOKUP?

For 2-way lookups, yes. XLOOKUP is easier to write, harder to break when you add new rows, and doesn't require you to count columns using your finger.