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.
 
Okay, post#6 is a piggy backing off of someone else's question... in hindsight, i should have posted by own question initially...

Also, I mentioned above that the results are not correct!! I will expand more in another reply.
 
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
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.
Hi - I've tried to amend this to get the correct results but I'm not able to (the 3 smallest aren't showing in the results). Do you have any other ideas or ways of getting the desired results in my example?

For clarity, the results are not correct... I would expect the following results from the Smallest 3 example of results:

slug, dog, rat
rat, cat, dog
slug, rat, dog
cat, slug, rat
slug, cat, dog
cat, dog, slug

Not the ones above.

Thanks in advance.
 
Upvote 0
How about
Fluff.xlsm
ABCDEFGHIJKLM
1catratdogslugSmallest 3Largest 3
2341621slugdogratcatratdog
348245099ratcatdogslugdogcat
43715202slugratdogcatdograt
525404533catslugratdogratslug
654656020slugcatdogratdogcat
730353030catdogslugratcatdog
Data
Cell Formulas
RangeFormula
G2:I7G2=TEXTSPLIT(TEXTJOIN(",",,BYROW(B2:E7,LAMBDA(r,TEXTJOIN("|",,TAKE(SORTBY(B1:E1,r,1),,3))))),"|",",")
K2:M7K2=TEXTSPLIT(TEXTJOIN(",",,BYROW(B2:E7,LAMBDA(r,TEXTJOIN("|",,TAKE(SORTBY(B1:E1,r,-1),,3))))),"|",",")
Dynamic array formulas.
 
Upvote 0
Works great, thanks fluff.

---------------------------------------
Solution to willbaggs' additional question in the comments of this original question - which is not quite the same as the original question.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
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