You are on page 1of 12

Use XLOOKUP to find the age of Jack

Age Name
12 John
13 Michael
14 Jake
12 Russel
16 Jack
15 Dan

Excel-Practice-
Online.com
Name: Jack Checking Tool:
Age <- Insert formula here
Use XLOOKUP to find the age of Jack
Age Name
12 John
13 Michael
14 Jake
12 Russel
16 Jack
15 Dan

Name: Jack
Age 16

The formula used here is:


16

Where B10 is Jack's name,


B3:B8 is our names lookup range
and A3:A8 is the age column from which the matching value is returned.
What is Dina's favorite color?
Note that some names appear more than once in the table!
In case of duplicates, return last matching value.

Name City Favorite Color


Dina New York Blue
Jake London Green
Joel Tel Aviv Red
Dina Melbourne Yellow
Sam Syndey Black
Ralph Beijing Green
John Dallas Red

Name: Dina
Favorite Color: <- Insert formula here
What is Dina's favorite color?
Note that some names appear more than once.
In case of duplicates, return last matching value.

Name City Favorite Color


Dina New York Blue
Jake London Green
Joel Tel Aviv Red
Dina Melbourne Yellow
Sam Syndey Black
Ralph Beijing Green
John Dallas Red

Name: Dina
Favorite Color: Yellow Yellow

Here are some possible solutions -


All solutions rely on using -1 in Search Mode (last argument):

Method #1:
Yellow Yellow
Here we keep "not found" and "match mode" empty.

Method #2:
Yellow Yellow
Here we use "not found" message in our if_not_found argument

Method #3:
Yellow Yellow
Using match mode 0 means using exact match (default behavior)
Return all car details for the car with Plate Number 5544667

Car Type Plate NumberColor Model Year


Toyota Corola 3343453 Red 2013
Nissan X Trail 5535334 Black 2015
Subaru Impreza 6474574 Red 2012
Mercedes S 600 5544667 Yellow 2014
Honda Civic 4356434 Blue 2015

Plate Number: 5544667


Car Type Plate NumberColor Model Year

^ Insert formula above


Return all car details for the car with Plate Number 5544667

Car Type Plate Number Color Model Year


Toyota Corola 3343453 Red 2013
Nissan X Trail 5535334 Black 2015
Subaru Impreza 6474574 Red 2012
Mercedes S 600 5544667 Yellow 2014
Honda Civic 4356434 Blue 2015

Plate Number: 5544667


Car Type Plate Number Color Model Year
Mercedes S 600 5544667 Yellow 2014

Formula:
#NAME? #NAME? #NAME? #NAME? #NAME?

In this example, we ask to look for the License Plate in cell B10,
Then we ask to lookup the value in range C4:C8.
Finally, we can return all the relevant data for this car by
higlighting range A4:E8, so Excel will return all the row if matched!
This magic happens using Excel Dynamic Arrays,
which allows returning multiple values!
What is Jacob's favorite food?
In case Jacob's name ins't in the table, return "Not found"

Name Favorite food


Dina Lobster
Jake Falafel
Joel Pasta
Dina Pizza
Sam Hamburger

Name: Jacob
Favorite food: <- Insert formula here
What is Jacob's favorite food?
In case Jacob's name ins't in the table, return "Not found"

Name Favorite food


Dina Lobster
Jake Falafel
Joel Pasta
Dina Pizza
Sam Hamburger

Name: Jacob
Favorite food: Not found

The formula to do so is:


Not found

We typed "Not found" to the if_not_found argument :)


Use XLOOKUP to return the gross profit for Q2:

Quarter Q1 Q2 Q3 Q4
Revenue 174,310 139,722 154,988 181,816
Cost of sales 112,921 112,466 113,796 101,873
Gross Profit 61,389 27,256 41,192 79,943

Gross Profit

Q2 <- Insert formula here


Use XLOOKUP to return the gross profit for Q2:

Quarter Q1 Q2 Q3 Q4
Revenue 174,310 139,722 154,988 181,816
Cost of sales 112,921 112,466 113,796 101,873
Gross Profit 61,389 27,256 41,192 79,943

Gross Profit

Q2 27,256

Solution: 27256

We can easily do a horizontal lookup (similar to HLOOKUP).


We use the same formula as in vertical lookups.
We just need to use horizontal range selection instead of vertical.
Easy, right?
Return the stock price for the day before and after January 4th 2020.

Date Stock Price


1/1/2020 105
1/2/2020 104
1/3/2020 106
1/5/2020 107
1/6/2020 103
1/7/2020 102

Date 1/4/2020

Price day before <- Insert formula here


Price day after <- Insert formula here
Return the stock price for the day before and after January 4th 2020.

Date Stock Price


1/1/2020 105
1/2/2020 104
1/3/2020 106
1/5/2020 107
1/6/2020 103
1/7/2020 102

Date 1/4/2020

Price day bef 106 106


Price day afte 107 107

Solution:
To use approximate match, we can type -1 or 1 in match_mode argument.
-1 will return next smallest match (January 3rd)
1 will return next largest match (January 5th).

You might also like