Adding spill to an xlookup with an array result only returns first result

%3CLINGO-SUB%20id%3D%22lingo-sub-1548927%22%20slang%3D%22en-US%22%3EAdding%20spill%20to%20an%20xlookup%20with%20an%20array%20result%20only%20returns%20first%20result%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1548927%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20situation%20where%20I%20need%20to%20lookup%20a%20range%20in%20a%20table%20on%20a%20spill%20reference%2C%20and%20that%20range%20needs%20to%20be%20dynamic.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20can%20take%20the%20below%20formula%20to%20get%20my%20range%20to%20do%20my%20lookup%20against%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3DXLOOKUP(A1%2C%24A%246%3A%24A%247%2C%24B%246%3A%24K%247)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnd%20by%20itself%20this%20spills%20to%20the%20right%20and%20pulls%20back%20the%20correct%20range%20to%20do%20my%20lookup%20against%2C%20which%20I%20can%20nest%20within%20another%20xlookup.%20As%20soon%20as%20I%20change%20the%20reference%20to%20spill%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3DXLOOKUP(A1%23%2C%24A%246%3A%24A%247%2C%24B%246%3A%24K%247)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20can%20see%20the%20result%20I%20want%20by%20hitting%20F9%20but%20when%20I%20let%20the%20calculation%20play%20out%20it%20results%20in%20the%20first%20value%20of%20the%20array%20only.%20Is%20there%20a%20workaround%20so%20that%20I%20can%20get%20this%20formula%20to%20spill%20vertically%20along%20with%20A1%20whilst%20returning%20the%20array%3F%20Otherwise%20I'm%20thinking%20I'll%20likely%20have%20to%20preemptively%20drag%20this%20formula%20down%3F%20I'm%20limited%20to%20working%20in%2032%20bit%20excel%20and%20will%20most%20likely%20be%20about%20a%20year%20of%20updates%20behind%3C%2FP%3E%3CDIV%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EKind%20regards%2C%3C%2FP%3E%3CP%3EJonny%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1548927%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1549001%22%20slang%3D%22en-US%22%3ERe%3A%20Adding%20spill%20to%20an%20xlookup%20with%20an%20array%20result%20only%20returns%20first%20result%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1549001%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F741607%22%20target%3D%22_blank%22%3E%40JonnyGreenwood%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPerhaps%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20606px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F208316iA1C95111937568F9%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Ewith%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DIFERROR(FILTER(%24B%246%3A%24K%247%2CIFNA(XMATCH(A6%3AA7%2CA1%23)%2C))%2C%22nothing%22)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Eif%20sorting%20order%20is%20not%20important%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1549005%22%20slang%3D%22en-US%22%3ERe%3A%20Adding%20spill%20to%20an%20xlookup%20with%20an%20array%20result%20only%20returns%20first%20result%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1549005%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F741607%22%20target%3D%22_blank%22%3E%40JonnyGreenwood%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESorry%20but%20that%20is%20the%20way%20it%20is%2C%26nbsp%3B%20Excel%20cannot%20handle%20arrays%20of%20arrays.%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3D%20XLOOKUP(%40spillRange%2C%20lookupArray%2C%20returnTable)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3Elooks%20up%20a%20single%20value%20and%20returns%20a%20row%20from%20the%20table%20(assuming%20%3CSTRONG%3EXLOOKUP%3C%2FSTRONG%3E%20is%20working%20in%20%3CSTRONG%3EHLOOKUP%3C%2FSTRONG%3E%20mode%20as%20in%20your%20case).%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3D%20XLOOKUP(%20spillRange%2C%20lookupArray%2C%20returnTable)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3Ewill%20lookup%20multiple%20values%20but%20only%20from%20the%20first%20column.%26nbsp%3B%20You%20would%20need%20to%20specify%20columns%20from%20your%20table%20individually%2C%20either%20constructing%20the%20relative%20references%20or%20by%20using%20%3CSTRONG%3EINDEX%3C%2FSTRONG%3E.%3C%2FP%3E%3CP%3EIf%20you%20require%20a%202D%20spill%20then%20%3CSTRONG%3EINDEX%2FXMATCH%3C%2FSTRONG%3E%20will%20do%20the%20job%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3D%20INDEX(%20returnTable%2C%20XMATCH(spillRange%2C%20lookupArray)%2C%20SEQUENCE(1%2C10)%20)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EThis%20last%20is%20a%20special%20case%20of%20the%20%3CSTRONG%3EINDEX%2FXMATCH%2FXMATCH%3C%2FSTRONG%3E%20that%20you%20might%20use%20for%20a%202D%20lookup.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1562941%22%20slang%3D%22en-US%22%3ERe%3A%20Adding%20spill%20to%20an%20xlookup%20with%20an%20array%20result%20only%20returns%20first%20result%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1562941%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F214174%22%20target%3D%22_blank%22%3E%40Peter%20Bartholomew%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20my%20table%2C%20I%20also%20want%20to%20populate%20its%20column%20and%20rows%20automatically%20using%20dynamic%20array%20function.%20(Screenshots%20attached).%3CBR%20%2F%3EI%20also%20experienced%20the%20same%20XLOOKUP%202D%20issue.%20I%20then%20tried%20the%20formula%20mentioned%20in%20your%20previous%20post%20with%20cats%20and%20dogs%20examples...%20but%20I%20probably%20did%20not%20parameter%20it%20properly%3A%20no%20data%20was%20retrieve%20in%20my%20Database%20table%3C%2FP%3E%3CP%3EIn%20my%20case%2C%20for%20each%20column%20of%20my%20Database%20table%2C%20I%20refer%20to%20a%20specific%20data%20extraction%20tab%2C%20and%20All%20the%20extraction%20tabs%20are%20formated%20with%202%20columns%3A%20doc%20name%20%26amp%3B%20Specific%20data.%3C%2FP%3E%3CP%3EThanks%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%20XLS%20DB%20To%20be%20populated.png%22%20style%3D%22width%3A%20643px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F210002i934FECC5A72F9958%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Screenshot%20XLS%20DB%20To%20be%20populated.png%22%20alt%3D%22Screenshot%20XLS%20DB%20To%20be%20populated.png%22%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%20XLS%20Tab%20Tag%20.png%22%20style%3D%22width%3A%20658px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F210003iD96C16C3D4B3BB93%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Screenshot%20XLS%20Tab%20Tag%20.png%22%20alt%3D%22Screenshot%20XLS%20Tab%20Tag%20.png%22%20%2F%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3EThanks%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1563355%22%20slang%3D%22en-US%22%3ERe%3A%20Adding%20spill%20to%20an%20xlookup%20with%20an%20array%20result%20only%20returns%20first%20result%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1563355%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F743769%22%20target%3D%22_blank%22%3E%40Vie29000%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20looks%20to%20me%20if%20the%20parameters%20are%20in%20a%20tangle.%26nbsp%3B%20Start%20off%20with%20just%20the%20match%2C%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3D%20XMATCH(%20Doc_Name%2C%20tblTag%5BDoc%20Name%5D)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EIf%20that%20doesn't%20return%20a%20plausible%20set%20of%20record%20numbers%2C%20the%20INDEX%20is%20not%20going%20to%20give%20anything%20useful.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThen%20nest%20the%20XMATCH%20within%20the%20INDEX.%26nbsp%3B%20the%20first%20parameter%20can%20be%20the%20entire%20lookup%20table%2C%20next%20the%20match%20to%20give%20the%20row%20number%20and%2C%20finally%2C%20an%20array%20of%20column%20indices%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3D%20INDEX(%20tblTag%2C%20XMATCH(%20Doc_Name%2C%20tblTag%5BDoc%20Name%5D)%2C%20%7B2%2C3%7D%20)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EFor%20two%20columns%2C%20it%20is%20not%20worth%20bothering%20with%20the%20SEQUENCE%20function%2C%20an%20array%20constant%20%7B2%2C3%7D%20will%20do%20the%20job%20more%20concisely.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Visitor

Hi all,

 

I have a situation where I need to lookup a range in a table on a spill reference, and that range needs to be dynamic. 

 

I can take the below formula to get my range to do my lookup against:

 

=XLOOKUP(A1,$A$6:$A$7,$B$6:$K$7)

 

And by itself this spills to the right and pulls back the correct range to do my lookup against, which I can nest within another xlookup. As soon as I change the reference to spill:

 

=XLOOKUP(A1#,$A$6:$A$7,$B$6:$K$7)

 

I can see the result I want by hitting F9 but when I let the calculation play out it results in the first value of the array only. Is there a workaround so that I can get this formula to spill vertically along with A1 whilst returning the array? Otherwise I'm thinking I'll likely have to preemptively drag this formula down? I'm limited to working in 32 bit excel and will most likely be about a year of updates behind

 

 

Kind regards,

Jonny

4 Replies
Highlighted

@JonnyGreenwood 

Perhaps

image.png

with

=IFERROR(FILTER($B$6:$K$7,IFNA(XMATCH(A6:A7,A1#),)),"nothing")

if sorting order is not important

 

Highlighted

@JonnyGreenwood 

Sorry but that is the way it is,  Excel cannot handle arrays of arrays.

= XLOOKUP(@spillRange, lookupArray, returnTable)

looks up a single value and returns a row from the table (assuming XLOOKUP is working in HLOOKUP mode as in your case).

= XLOOKUP( spillRange, lookupArray, returnTable)

will lookup multiple values but only from the first column.  You would need to specify columns from your table individually, either constructing the relative references or by using INDEX.

If you require a 2D spill then INDEX/XMATCH will do the job

= INDEX( returnTable, XMATCH(spillRange, lookupArray), SEQUENCE(1,10) )

This last is a special case of the INDEX/XMATCH/XMATCH that you might use for a 2D lookup.

Highlighted

@Peter Bartholomew 

In my table, I also want to populate its column and rows automatically using dynamic array function. (Screenshots attached).
I also experienced the same XLOOKUP 2D issue. I then tried the formula mentioned in your previous post with cats and dogs examples... but I probably did not parameter it properly: no data was retrieve in my Database table

In my case, for each column of my Database table, I refer to a specific data extraction tab, and All the extraction tabs are formated with 2 columns: doc name & Specific data.

Thanks
Screenshot XLS DB To be populated.pngScreenshot XLS Tab Tag .png

Thanks

 

 

Highlighted

@Vie29000 

It looks to me if the parameters are in a tangle.  Start off with just the match,

= XMATCH( Doc_Name, tblTag[Doc Name])

If that doesn't return a plausible set of record numbers, the INDEX is not going to give anything useful.

 

Then nest the XMATCH within the INDEX.  the first parameter can be the entire lookup table, next the match to give the row number and, finally, an array of column indices

= INDEX( tblTag, XMATCH( Doc_Name, tblTag[Doc Name]), {2,3} )

For two columns, it is not worth bothering with the SEQUENCE function, an array constant {2,3} will do the job more concisely.