Concatenate unique text values in Excel 2016 (based on criteria in range)

art_TD

New Member
Joined
Sep 19, 2024
Messages
10
Office Version
  1. 2016
Hi! Could you please help with such issue?
I am trying to concatenate unique (exact) text values within a range (Name) based on a criteria in another range (Code). No VBA please, just formula(s).

CodeNameConcat
12345​
RollerRollerRoller; idler; sprocket;
12345​
Rolleridler; sprocket;
12345​
Rolleridler; sprocket;
12345​
Rolleridler; sprocket;
12345​
Rolleridler; sprocket;
12345​
Rolleridler; sprocket;
12345​
Rolleridler; sprocket;
12345​
IdlerIdlerIdler; sprocket;
12345​
Idlersprocket;
12345​
Idlersprocket;
12345​
Idlersprocket;
12345​
Idlersprocket;
12345​
Idlersprocket;
12345​
Idlersprocket;
12345​
Idlersprocket;
12345​
Idlersprocket;
12345​
Idlersprocket;
12345​
SprocketSprocketSprocket;
12345​
Sprocket
12345​
Sprocket
12345​
Sprocket
12345​
Sprocket
12345​
Sprocket
12345​
Sprocket
12345​
Sprocket
12345​
Sprocket
12345​
Sprocket
54321
RollerRollerRoller; ???; ???
54321
Idler
54321
Sprocket
 
I found out there could be some mistakes (on another longer list of codes and names) and got the formulas as follows.

Cell Formulas
RangeFormula
C2:C31C2=IF(COUNTIFS($A$2:A2,A2,$B$2:B2,B2)=1,B2,"")
D2:D31D2=IF(A3="",C2&";",IF(NOT(A2=A3),"",IF(C2="",D3,C2&"; "&D3)))
E2:E31E2=IF(A3="",C2,IF(NOT(A2=A3),"",IF(C2="",E3,C2&IF(E3="","","; ")&E3)))
 
Upvote 0

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Hi! Sorry there should have been not only NOT function but as follows.

Cell Formulas
RangeFormula
C2:C31C2=IF(COUNTIFS($A$2:A2,A2,$B$2:B2,B2)=1,B2,"")
D2:D31D2=IF(A3="",C2&";",IF(NOT(A2=A3),C2,IF(C2="",D3,C2&"; "&D3)))
E2:E31E2=IF(A3="",C2,IF(NOT(A2=A3),C2,IF(C2="",E3,C2&IF(E3="","","; ")&E3)))

I don't know how to put the sheet to my post. Hope you will understand it on the snapshot.

D - your formula, F - my adjusted variant.

1727083394292.png
 
Upvote 0
Sorry, I am giving up here, I don't know how to get the results as expected in post #10.

Hopefully someone else can help you on this!

But out of curiosity, can you post the formula you adjusted in column F.
 
Upvote 0
art_TD,

Please Note: In the future, when marking a post as the solution, please mark the post that contains the solution to your original question (not your own post acknowledging that some other post was the solution).
When a post is marked as the solution, it is then shown right underneath the original question so people viewing the question can easily see the question and solution in a single quick glance without having to hunt through all the posts.

I have updated this thread for you.
 
Upvote 0
Joe4,

Thanks for taking the time to do this! I will follow this rule in the future.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

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