I am currently using this formula:
=SORT(QUERY(G:Z, "select K,count(K) where K is not null group by K label count(K)''"),2,TRUE)
I have to replace all instances of "K" with a column letter that is written in cell B2, so I can quickly change the entire formula by simply entering the letter in the cell.
Any advice?
Thanks
CodePudding user response:
Use string concatenation:
=SORT(QUERY(E:K, "select " & D1 &" ,count(" & D1 &") where " & D1 &" is not null group by " & D1 &" label count(" & D1 &")''"),2,TRUE)
CodePudding user response: