Nested XLOOKUP Workout
- 03:42
Understand how to use nested XLOOKUP in Excel.
Glossary
Excel Nested xlookup XlookupsTranscript
In this workout, we're going to use Xlookup to look up two different inputs. Those two different inputs will help us find what we're after. So firstly, we're told that we need to look up the product ID A134, A134. In that first column there will give us the row and it'll be this row that we'll then look in, but then we're not sure which column to go for. Do we go for the price column, the quantity sold column, or the revenue column? So we need a second look up. We're going to look up the column with price in. So we're going to hopefully end up with a price of 3.5. Let's use Xlookup to do this. Firstly, it asks me for the lookup value when I'm going to look up the row, and that was A134. That's my lookup value lookup array. And it will choose the first row outta this pinkish reddish box. But when it comes to the return array, I'm now not sure which column to go for. There may be lots of columns here, and I might want to keep it flexible. I might want to change the word price to one of the other column headings later. What we're gonna do is we're gonna put a second Xlookup here to choose the column. So I need to look up the value price, and now it asks me where to look it up. The lookup array are these three green cells just highlighted at the top.
Now the return array will be this area underneath. So let's have a quick think what's happened. The first Xlookup is going to look up A134 from this reddish box on the left hand side, and it'll grab A134. So we're only looking in this row next to A134 thereafter. But which column are we going to choose? Well, we then hook up another item price from the green cells, the three green cells at the top, it grabs the price column and then returns the area underneath. So it then looks up A134 and price to give me 3.5. Fantastic. If I was using another function such as Vlookup or index or offset, I'd have to use a match and probably a double match function to do this. So index, match match. Whereas here I can just stick with one function syntax, Xlookup Xlookup. Let's do another version. In this next workout underneath, I'm asked to look up a client's account. PS983. So we will look up, firstly in this area here, we'll find the row, but then which column do we want? Well, I want the income column. So I'll look at the headings at the top and I'll grab the income and I should end up at 238. So let's use Xlookup to do that. It firstly asks for the lookup value, that's the client account number. I look in the client account number area, but then the return array, oh, I'm not sure which column to use. So let's use that other Xlookup to look up income in the three items at the top that will choose us the correct column.
And then the return array is the area underneath double close brackets and we get 238.