XLOOKUP - [if not found] argument question

cvrband

Board Regular
Joined
Jan 6, 2016
Messages
63
Office Version
  1. 365
Platform
  1. Windows
I have an 'xlookup' formula in cell C4 that spills as expected to the required rows, but I'm having an issue with the [if not found] argument not returning the correct data. The data I want [if not found] to return is text in the same row from another spilled array starting in cell E4. (note: the spilled arrays from C4 and E4 always have the same number of rows) I can't think of a good way to present example data due to the complexity, so here is the gist of the formula in cell C4:
Excel Formula:
=XLOOKUP(D4#, lookup_array, return_array, "Not found:  "&E4#)

The issue I'm having is that the [if not found] argument only returns the text from cell E4 no matter what row is being calculated. I expected that the spilled formula in row 7 would return the text from cell E7 for [if not found], but it only returns the text in cell E4.

Simplifying the formula in C4 to the following also always results in the text from cell E4 being returned for [if not found]:
Excel Formula:
=XLOOKUP(D4#, lookup_array, return_array, E4#)

I also tried this with the same result:
Excel Formula:
=XLOOKUP(D4#, lookup_array, return_array, "Not found:  "&INDIRECT("E"&row()))

To troubleshoot, I tried placing
Excel Formula:
=INDIRECT("E"&row())
in another cell in row 7 with it returning the desired result, so I am very confused at this point.

What can I do to return the correct data for the current row [if not found]? Thanks
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Seems to work OK for me.
Book1
ABCDEF
1Not found: 1Lookup Array1Return Array1Lookup Array 11Not found: 1
2Not found: 2Lookup Array2Return Array2Not found: 2
3Not found: 3Lookup Array3Return Array3Not found: 3
4Not found: 4Lookup Array4Return Array4Not found: 4
5Not found: 5Lookup Array5Return Array5Not found: 5
6Not found: 6Lookup Array6Return Array6Not found: 6
7Not found: 7Lookup Array7Return Array7Not found: 7
8Not found: 8Lookup Array8Return Array8Not found: 8
9Not found: 9Lookup Array9Return Array9Not found: 9
10Not found: 10Lookup Array10Return Array10Not found: 10
Sheet2
Cell Formulas
RangeFormula
A1:A10A1="Not found: " & SEQUENCE(10)
B1:B10B1="Lookup Array" & SEQUENCE(10)
C1:C10C1="Return Array" & SEQUENCE(10)
F1:F10F1=XLOOKUP(E1,B1#,C1#, A1#,0)
Dynamic array formulas.
 
Upvote 0
When looking up an array of vales, you cannot have an array of values for the Not found argument.
 
Upvote 0
You could do something like this:

Excel Formula:
=MAP(D4#,E4#,LAMBDA(d,e,XLOOKUP(d, lookup_array, return_array, e)))
 
Upvote 0
Solution
@RoryA - that solution does exactly what I need. Thank you for your time and expertise.

Thank you all for your responses!
 
Upvote 0

Forum statistics

Threads
1,215,453
Messages
6,124,920
Members
449,195
Latest member
Stevenciu

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