excel表格公式问题
如果仅20行,使用这个方法,比较简单易懂,不用动脑筋,如下:
使用公式
=A1&IF(COUNTIF($A$1:A2,A2)=1,A2,"")&IF(COUNTIF($A$1:A3,A3)=1,A3,"")&IF(COUNTIF($A$1:A4,A4)=1,A4,"")&IF(COUNTIF($A$1:A5,A5)=1,A5,"")&IF(COUNTIF($A$1:A6,A6)=1,A6,"")&IF(COUNTIF($A$1:A7,A7)=1,A7,"")&IF(COUNTIF($A$1:A8,A8)=1,A8,"")&IF(COUNTIF($A$1:A9,A9)=1,A9,"")&IF(COUNTIF($A$1:A10,A10)=1,A10,"")&IF(COUNTIF($A$1:A11,A11)=1,A11,"")&IF(COUNTIF($A$1:A12,A12)=1,A12,"")&IF(COUNTIF($A$1:A13,A13)=1,A13,"")&IF(COUNTIF($A$1:A14,A14)=1,A14,"")&IF(COUNTIF($A$1:A15,A15)=1,A15,"")&IF(COUNTIF($A$1:A16,A16)=1,A16,"")&IF(COUNTIF($A$1:A17,A17)=1,A17,"")&IF(COUNTIF($A$1:A18,A18)=1,A18,"")&IF(COUNTIF($A$1:A19,A19)=1,A19,"")&IF(COUNTIF($A$1:A20,A20)=1,A20,"")
如果是只想在一个单元格用公式得出结果,Excel 2013以前貌似只能借助VBA自定义函数实现(操作起来倒也简单,就是文件要保存成xlsm),好用的TEXTJOIN函数是Excel 2016才出现的,有条件升级一下也可以考虑使用。
如果不升级,不用VBA,可以通过加1个辅助列处理,如数据在A1:A5000,则
B1=A1
B2=IF(COUNTIF($A$1:A2,$A$1:$A$5000)=1,B1&$A$1:$A$5000,B1)
B2公式复制到B5000,这样就能在B5000得到答案。这个方法不需要考虑A列是什么数据类型,只要合并起来总字符数不超过32767即可。
这种方法逆序也很容易,就是
B1=IF(COUNTIF($A1:$A$5000,$A$1:$A$5000)=1,B2&$A$1:$A$5000,B2)
B1公式复制到B4999,
B5000=A5000
即可在B1得到答案。
以上希望能帮上忙!
5000行
行数太多,需要换一个方式。请问一下内容应该不是全部一位数字吧?大概会有哪些内容?数字还是有文本?只要在一个单元格体现结果吗?
2019-10-13 · 知道合伙人软件行家
=IFERROR(IF(LARGE((FREQUENCY(A1:A19,(ROW(A19)-ROW(A1:A19))%%+A1:A19)>0)*ROW(A1:A20)*10^8+A1:A20,COLUMN($A$1:$O$1))<10^8,"",--RIGHT(LARGE((FREQUENCY(A1:A19,(ROW(A19)-ROW(A1:A19))%%+A1:A19)>0)*ROW(A1:A20)*10^8+A1:A20,COLUMN($A$1:$O$1)),8)),"")&=IFERROR(IF(LARGE((FREQUENCY(A1:A19,(ROW(A19)-ROW(A1:A19))%%+A1:A19)>0)*ROW(A1:A20)*10^8+A1:A20,COLUMN($A$1:$O$1))<10^8,"",--RIGHT(LARGE((FREQUENCY(A1:A19,(ROW(A19)-ROW(A1:A19))%%+A1:A19)>0)*ROW(A1:A20)*10^8+A1:A20,COLUMN($A$1:$O$1)),8)),"")&=IFERROR(IF(LARGE((FREQUENCY(A1:A19,(ROW(A19)-ROW(A1:A19))%%+A1:A19)>0)*ROW(A1:A20)*10^8+A1:A20,COLUMN($A$1:$O$1))<10^8,"",--RIGHT(LARGE((FREQUENCY(A1:A19,(ROW(A19)-ROW(A1:A19))%%+A1:A19)>0)*ROW(A1:A20)*10^8+A1:A20,COLUMN($A$1:$O$1)),8)),"")&=IFERROR(IF(LARGE((FREQUENCY(A1:A19,(ROW(A19)-ROW(A1:A19))%%+A1:A19)>0)*ROW(A1:A20)*10^8+A1:A20,COLUMN($A$1:$O$1))<10^8,"",--RIGHT(LARGE((FREQUENCY(A1:A19,(ROW(A19)-ROW(A1:A19))%%+A1:A19)>0)*ROW(A1:A20)*10^8+A1:A20,COLUMN($A$1:$O$1)),8)),"")&=IFERROR(IF(LARGE((FREQUENCY(A1:A19,(ROW(A19)-ROW(A1:A19))%%+A1:A19)>0)*ROW(A1:A20)*10^8+A1:A20,COLUMN($A$1:$O$1))<10^8,"",--RIGHT(LARGE((FREQUENCY(A1:A19,(ROW(A19)-ROW(A1:A19))%%+A1:A19)>0)*ROW(A1:A20)*10^8+A1:A20,COLUMN($A$1:$O$1)),8)),"")