concatenate unique values, based on criteria without macros

atearth

New Member
Joined
Feb 25, 2015
Messages
39
Office Version
  1. 365
  2. 2013
  3. 2007
Platform
  1. Windows
  2. Web
Please see the imagine.


https://imgur.com/a/haW7m1x

I have a table of information.


you can seen cell C15 shows certification number is 2.


What formula should I use in cell C16 so it shows 123, 321, 111.


concatenate unique values only, based on criteria without macros?


How is it done?


Thank you in advance.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Please see the image

wZ3JP65.png

https://imgur.com/a/haW7m1x

I have a table of information.


you can seen cell C15 shows certification number is 2.


What formula should I use in cell C16 so it shows 123, 321, 111.


concatenate unique values only, based on criteria without macros?


How is it done?


Thank you in advance.
 
Last edited:
Upvote 0
Without macros, you'd need the TEXTJOIN function available in Excel 365.

ABC
1
2Certification NumberReference
31ABC
41CBA
52123
62321
72321
82111
93ABC1
103ABC2
1141A
1242A
1342A
14
15Certification Number2
16Reference123, 321, 111

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Array Formulas
CellFormula
C16{=TEXTJOIN(", ",1,IF(B3:B13=C15,IF(MATCH(B3:B13&"|"&C3:C13,B3:B13&"|"&C3:C13,0)=ROW(B3:B13)-ROW(B3)+1,C3:C13,""),""))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>
 
Upvote 0
With an auxiliary column

<table border="1" cellspacing="0" style="font-family:Calibri,Arial; font-size:11pt; background-color:#ffffff; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:109.31px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td > </td><td >A</td><td >B</td><td >C</td><td >D</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >1</td><td > </td><td > </td><td > </td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >2</td><td > </td><td style="background-color:#538ed5; color:#ffffff; ">CER NUM</td><td style="background-color:#538ed5; color:#ffffff; ">REF</td><td style="background-color:#538ed5; color:#ffffff; ">AUX</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >3</td><td > </td><td style="text-align:right; ">1</td><td >ABC</td><td >  123  321 111      </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >4</td><td > </td><td style="text-align:right; ">1</td><td >CA</td><td > 123  321 111      </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >5</td><td > </td><td style="text-align:right; ">2</td><td style="text-align:right; ">123</td><td >123  321 111      </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >6</td><td > </td><td style="text-align:right; ">2</td><td style="text-align:right; ">321</td><td > 321 111      </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >7</td><td > </td><td style="text-align:right; ">2</td><td style="text-align:right; ">321</td><td >321 111      </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >8</td><td > </td><td style="text-align:right; ">2</td><td style="text-align:right; ">111</td><td style="text-align:right; ">111      </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >9</td><td > </td><td style="text-align:right; ">3</td><td >ABC1</td><td >     </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >10</td><td > </td><td style="text-align:right; ">3</td><td >ABC2</td><td >    </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >11</td><td > </td><td style="text-align:right; ">4</td><td style="text-align:right; ">1A</td><td >   </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >12</td><td > </td><td style="text-align:right; ">4</td><td style="text-align:right; ">2A</td><td >  </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >13</td><td > </td><td style="text-align:right; ">4</td><td style="text-align:right; ">2A</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >14</td><td > </td><td > </td><td > </td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >15</td><td > </td><td style="background-color:#538ed5; color:#ffffff; ">CER NUM</td><td style="text-align:right; ">2</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >16</td><td > </td><td style="background-color:#538ed5; color:#ffffff; ">REF</td><td >123, 321, 111</td><td > </td></tr></table><br /><table style="font-family:Arial; font-size:10pt; border-style: groove ;border-color:#00ff00;background-color:#fffcf9; color:#000000; "><tr><td ><b></b></td></tr><tr><td ><table border = "1" cellspacing="0" cellpadding="2" style="font-family:Arial; font-size:9pt;"><tr style="background-color:#cacaca; font-size:10pt;"><td >Cell</td><td >Formula</td></tr><tr><td >D3</td><td >=IF(B3=$C$15,IF(COUNTIF(C3:$C$13,C3)=1,C3,""),"")&" "&D4</td></tr><tr><td >C16</td><td >=SUBSTITUTE(TRIM(D3)," ",", ")</td></tr></table></td></tr></table>

Formula in D3 copy down.
 
Upvote 0
Thank you Eric W
user-online.png
I will give it a try on 365.

What can be done on 2016?

Would using text join be an option on 2016?
 
Last edited:
Upvote 0
No, TEXTJOIN is not available on 2016. It might be on 2019, and definitely is on 365. If you don't have one of those options, you'll have to use a helper column, like Dante's example. It's also worth noting that if you do use a helper (auxiliary) column, you can hide it so you don't have to see it.
 
Last edited:
Upvote 0
you can try with PowerQuery (Get&Transform)

Certification NumberReference
1​
ABC
1​
CBA
2​
123​
2​
321​
2​
321​
2​
111​
3​
ABC1
3​
ABC2
4​
1A
4​
2A
4​
2A
Certification Number
Input
2​
Reference
List
123 321 111​

Code:
[SIZE=1]// Result
let
    Tbl1 = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Tbl2 = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    Source = Table.NestedJoin(Tbl2,{"Input"},Tbl1,{"Certification Number"},"Tbl1",JoinKind.LeftOuter),
    List = Table.AddColumn(Source, "List", each List.Distinct(Table.Column([Tbl1],"Reference"))),
    Extract = Table.TransformColumns(List, {"List", each Text.Combine(List.Transform(_, Text.From), " "), type text}),
    ROC = Table.SelectColumns(Extract,{"List"})
in
    ROC[/SIZE]
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,845
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top