XLOOKUP within LAMBDA BYCOL

samdthompson

New Member
Joined
May 1, 2018
Messages
14
Hello, I am wanting to spill an xlookup of a maximum number but am hitting a #VALUE error. The basic format is:

weekcatratintended resultbasic intent
23416cat=xlookup(max(b2:c7),$b$2:$c$7,$b$1:$c$1))
34824cat
43715cat
52540rat
65445cat
73839rat

I get that xlookup wont work in this instance so would like to use BYROW but I cannot seem to get it working. I figured something like:

=BYROW(b2:c7,LAMBDA(v,a,r,XLOOKUP(v,a,r)(max(b2:c7),b2:c7,b1:c1)) would work but no dice. Since there is a substantial variation in the number of possible rows, I do want a spilling result.

And yes I get that I should be using the downloadable mini sheet thing but that would require me to have admin rights to install on my laptop.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
If I understand correctly, this is all you need:

Book1
ABCD
1WeekCatRatIntended Result
223416Cat
334824Cat
443715Cat
552540Rat
665445Cat
773839Rat
8
Sheet8
Cell Formulas
RangeFormula
D2:D7D2=IF(B2:B7>C2:C7,B1,C1)
Dynamic array formulas.
 
Upvote 0
If I understand correctly, this is all you need:

Book1
ABCD
1WeekCatRatIntended Result
223416Cat
334824Cat
443715Cat
552540Rat
665445Cat
773839Rat
8
Sheet8
Cell Formulas
RangeFormula
D2:D7D2=IF(B2:B7>C2:C7,B1,C1)
Dynamic array formulas.
your right, but i have a bunch more columns to deal with, I needed to truncate for simplicity. There should be something like 26 columns.
 
Upvote 0
Like this perhaps:

ABCDEFG
1catratdogslugResult
2341621cat
348245099slug
43715202cat
525404533dog
654656020rat
740393040cat
ColorCount
Cell Formulas
RangeFormula
G2:G7G2=LET(d,B2:E7,hdr,B1:E1,INDEX(hdr,BYROW(d=BYROW(d,LAMBDA(r,MAX(r))),LAMBDA(r,MATCH(TRUE,r,)))))
Dynamic array formulas.

Note that this will display only one result per row, even if there are duplicates.
 
Upvote 0
Solution
This is exactly right. Thanks so very much.


Like this perhaps:

ABCDEFG
1catratdogslugResult
2341621cat
348245099slug
43715202cat
525404533dog
654656020rat
740393040cat
ColorCount
Cell Formulas
RangeFormula
G2:G7G2=LET(d,B2:E7,hdr,B1:E1,INDEX(hdr,BYROW(d=BYROW(d,LAMBDA(r,MAX(r))),LAMBDA(r,MATCH(TRUE,r,)))))
Dynamic array formulas.

Note that this will display only one result per row, even if there are duplicates.
 
Upvote 0
Any ideas on how to do it for spilled results across and down... Eg I'm using SMALL function to find the 3 smallest values for each person:

1718294111562.png


Using your answer above only seems to be suitable for one column spill:

1718294219355.png
 
Upvote 0
One way.
Book1
ABCDEFGHIJKLM
1catratdogslugSmallest 3Largest 3
2341621ratdogslugcatratdog
348245099catratdogcatdogslug
43715202ratdogslugcatratdog
525404533catratslugratdogslug
654656020catdogslugcatratdog
730353030catdogslugratdogslug
Sheet3
Cell Formulas
RangeFormula
G2:I7G2=TEXTSPLIT(TEXTJOIN(",",,BYROW(B2:E7,LAMBDA(r,TEXTJOIN("|",,TAKE(SORT(FILTER(B1:E1,r<=SMALL(r,3))),,-3))))),"|",",")
K2:M7K2=TEXTSPLIT(TEXTJOIN(",",,BYROW(B2:E7,LAMBDA(r,TEXTJOIN("|",,TAKE(SORT(FILTER(B1:E1,r>=LARGE(r,3))),,-3))))),"|",",")
Dynamic array formulas.
 
Upvote 0
Thanks for responding - I'll have a play around with this... the results aren't quite correct.
 
Upvote 0
@Fluff with all due respect, I don't believe this is the same, I did not post the initial question on this thread... can you please re-instate the question that I just posted as it is most definitely not a duplicate post, as this post is not mine. I believe I will get the answer I'm looking for with my own question being posted.
 
Upvote 0
It is a duplicate of post#6 in this thread & the other thread will remain locked.
Also you have had an answer here, but have given no information of what is wrong.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

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