想要搜索范围A1:G1并比较最后两个非零值,如果最后一个值高于倒数第二个值则返回单词“Better”,如果最后一个值低于第二个值,则返回“Worse”持续有些细胞可能是空的。示例如下。
45 6 7 0 4 Worse
1 45 65 0 0更好
答案 0 :(得分:0)
使用此公式:
=IF(INDEX(A1:G1,,AGGREGATE(14,6,COLUMN(A1:G1)/(A1:G1>0),2))>INDEX(A1:G1,,AGGREGATE(14,6,COLUMN(A1:G1)/(A1:G1>0),1)),"Worse","Better")
AGGREGATE()函数是在excel 2010中引入的。
编辑:根据评论:
=IF(INDEX($E23:$CB23,,AGGREGATE(14,6,(COLUMN($E23:$CB23)-COLUMN($E:$E)+1)/($E23:$CB23>0),2))>INDEX($E23:$CB23,,AGGREGATE(14,6,(COLUMN($E23:$CB23)-COLUMN($E:$E)+1)/($E23:$CB23>0),1)),"Worse",IF(INDEX($E23:$CB23,,AGGREGATE(14,6,(COLUMN($E23:$CB23)-COLUMN($E:$E)+1)/($E23:$CB23>0),2))<INDEX($E23:$CB23,,AGGREGATE(14,6,(COLUMN($E23:$CB23)-COLUMN($E:$E)+1)/($E23:$CB23>0),1)),"Better","No Change"))