Finding elements that are unique in one column excel

人盡茶涼 提交于 2019-12-12 01:03:55

问题


I have two columns in excel that have some shared data and some unique data to each column. What I want is to have two more columns that will have the data that is in Column A but not B and the data that is in Column B but not in A. I have tried using Vlookups but I don't think I can get what I am looking for by doing this.


回答1:


For Col A items not in column B, try this array-entered formula (entered in some cell, then fill down until it returns blanks)

=IFERROR(INDEX(ColA,SMALL(IF(ISNA(MATCH(ColA,ColB,0)),ROW(ColA),""),ROWS($1:1))-1),"")

and for Col B items not in Column A:

=IFERROR(INDEX(ColB,SMALL(IF(ISNA(MATCH(ColB,ColA,0)),ROW(ColB),""),ROWS($1:1))-1),"")

The formulas assume that your data starts in row 2 (row 1 would be a label) and the ranges ColA and ColB also start in Row 2

The formulas also assume no blanks in the data. If there are empty cells, then use these formulas:

=IFERROR(INDEX(ColA,SMALL(IF(ISNA(MATCH(ColA,ColB,0))*(ColA<>""),ROW(ColA)),ROWS($1:1))-1),"")

=IFERROR(INDEX(ColB,SMALL(IF(ISNA(MATCH(ColB,ColA,0))*(ColB<>""),ROW(ColB)),ROWS($1:1))-1),"")

Example Image:




回答2:


Easy with a PivotTable, if you are prepared to rearrange your data somewhat:



来源:https://stackoverflow.com/questions/21686456/finding-elements-that-are-unique-in-one-column-excel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!