Xlookup - empty cells

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
Why f3:f5 values is 2 when the quantity cells E3:E5 are empty? Thank you very much.

Book1
ABCDEF
1QuantityUnit PriceQuantityPrice
21$ 1002290
310$ 902
450$ 802
5100$ 502
6200$ 40
7300$ 30
8500$ 20
9600$ 10
10800$ 5
111000$ 2
12
Sheet1
Cell Formulas
RangeFormula
F2:F5F2=XLOOKUP(E2,$A$2:$A$11,$B$2:$B$11,"",-1)
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
The -1 option that you are using is defined as

-1 - Exact match. If none found, return the next smaller item.
 
Upvote 0
Because you are not doing an exact match. As E3 is empty it returns the next smallest value to "" which is the largest number in col A.
 
Upvote 0
The next smallest value of the Quantity or the Price?

This is how I understand it:

E3 = empty (quantity is empty)

Now go to the main table (A1:A10) and search for E3= empty ... will not find any match. Then it should go with an approximate match. I was thinking it should go with Quantity = 1 and the price is 100. But it seems it match E3 = empty with A11 which has the value of Price is 2. That how Vlookup works, no? Thank you.
 
Upvote 0
That how Vlookup works, no?
But you aren't dealing with Vlookup

 
Upvote 0
It would appear that Xlookup treats an empty cell as "" which is text & therefore greater than any number.
 
Upvote 0
Solution
Thanks, that is really better. I was questioning my Xlookup understanding. Thanks all.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,923
Messages
6,122,289
Members
449,077
Latest member
Rkmenon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top