特定列中的元素是否与列标签具有相同的内容?如果没有,这里有一个可行的方法,尽管它有点草率。
=LET(z,TOCOL(,1),range,A1:D5,query(arrayformula(split(tocol(bycol(range,lambda(k,REDUCE(z,k,LAMBDA(a,c,vstack(a,if(c=index(k,1,1),z,if(c<>"",index(k,1,1)&"|"&c,z))))))),3,1),"|")),"select Col1,Col2 order by Col2 asc"))