You can try the following, assuming no Excel version constraints as per the tag listed in the question:
=LET(in,B2:D4,BYROW(MAKEARRAY(ROWS(in),COLUMNS(in), LAMBDA(i,j,
RANK(INDEX(in,i,j),INDEX(B2:D4,,j)))),LAMBDA(z, AVERAGE(z))))
Note
Under Excel for Web, I tested you can use INDEX(in,,j)
instead of INDEX(B2:D4,,j)
. As @JosWoolley pointed out in the comment section, testing the formula using the name ìn
produces a #CALC!
(Nested array error) for desktop under O365. I tested also for this desktop version: Microsoft 365 Apps for Enterprise Version 2304 (Build 16327.20214 Current Channel). A possible bug or inconsistency in Microsoft update/release channel policy. I posted this issue in the Microsoft Feedback community, here is the link, in case you would like to vote for it.
Another workaround to avoid this error and keep using the name in
, is to create a LAMBDA(B2:D4)
function, i.e. "thunking the range" and name it in
, then to refer it. It ensures the formula is easier to maintain (if you need to update the range, update it in one place only). For example:
=LET(in, LAMBDA(B2:D4), BYROW(MAKEARRAY(ROWS(in()),COLUMNS(in()), LAMBDA(i,j,
RANK(INDEX(in(), i,j), INDEX(in(),,j)))),LAMBDA(z, AVERAGE(z))))
Notice how we call it: in()
.
Here is the output:

MAKEARRAY
iterates over all elements of the input (in
) and calculate the RANK
for a given element (i
,j
) with respect to column j
of in
. Then we invoke BYROW
on the MAKEARRAY
result to calculate on each row the average.