简体   繁体   English

Excel公式返回唯一记录(空单元格除外)

[英]Excel formula returning unique records except empty cells

example data in A1:A10: A1:A10中的示例数据:

red
[empty]
blue
red
red
[empty]
green
green
[empty]
voilet

Where [empty] is blank cell. 其中[empty]是空白单元格。

Array formula (CTRL + SHIFT + ENTER) in B2 and further down: B2中及以下的数组公式(CTRL + SHIFT + ENTER):

=INDEX($A$1:$A$10,MATCH(0,COUNTIF($B$1:B1,$A$1:$A$10),0))

returns following: 返回以下内容:

red
0
blue
green
voilet

Can you advise any solution to return only values which are not empty? 您能否建议任何解决方案只返回不为空的值? Simply to get rid of this 'zero'? 只是要摆脱这个“零”? I could hide 3rd row, but sometimes first empty cell is further down and then 'zero' would be for example 3rd or 4th in the list. 我可以隐藏第3行,但有时第一个空单元格会更靠后,然后“零”将成为列表中的第3或第4位。

At the end, I would like to get list in column B (or any other column) like this: 最后,我想像这样在B列(或任何其他列)中获取列表:

red
blue
green
voilet

在单元格B2中使用此常规公式(无需ctrl + shift + enter)并向下复制:

=INDEX($A$1:$A$10,MATCH(1,INDEX(($A$1:$A$10<>"")*(COUNTIF(B$1:B1,$A$1:$A$10)=0),),0))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM