简体   繁体   中英

Excel formula returning unique records except empty cells

example data in A1:A10:

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

Where [empty] is blank cell.

Array formula (CTRL + SHIFT + ENTER) in B2 and further down:

=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.

At the end, I would like to get list in column B (or any other column) like this:

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))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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