Excel: How to gather unique values in one column that are associated with duplicates in another column?

后端 未结 2 411
不思量自难忘°
不思量自难忘° 2021-01-13 16:08

With data such as this:

Column A     Column B
1               98
1               12
1               21 
1               31   
2               37
2                    


        
2条回答
  •  余生分开走
    2021-01-13 16:42

    First, you need to extract unique value from Column A to Column C. You can do it by using Advance Filter method or you can use below formula.

    =IFERROR(INDEX($A$2:$A$18,MATCH(0,INDEX(COUNTIF($C$1:C1,$A$2:$A$18),0,0),0)),"")
    

    After extracting unique values you have to use TEXTJOIN() formula to aggregate values from Column B to Column D. You have TEXTJOIN() formula in your excel version then you can use it like below

    =TEXTJOIN(", ",TRUE,IF($A$2:$A$18=C2,$B$2:$B$18,""))
    

    Otherwise you have to user VBA custom function to write TextJoin() formula. For TEXTJOIN() custom function you can have look to this post. Post Link

提交回复
热议问题