I am trying to find the Mode for several columns in a sheet. If I want to find the mode in column A, I use the following formula. =INDEX(A:2;MODE(MATCH(A:A;A:A;0)))
The data is however too large for me to individually enter each column, so I would like to know if there is a way to make the above formula dynamic in a sense that it would find the column based on the row name on the left.
So if I were to enter the formula on the cell C7(image 1), I could locate that the corresponding column on image 2 is A.
CodePudding user response:
Try:
Formula in C2
:
=MAP(A2:A4,LAMBDA(x,LET(a,XLOOKUP(x,D1:F1,D2:F5),b,UNIQUE(a),TAKE(SORTBY(b,MAP(b,LAMBDA(c,SUM(--(a=c)))),-1),1))))