Find and concat same values in excel

parthi_75

New Member
Joined
Aug 15, 2002
Messages
7
HI,
I NEED TO FIND VALUES AND CONCAT IT. BELOW IS THE DETAILS

DATA'S
a 1
b 2
c 3
d 4
a 100
b 101
c 102
d 103


NEED FORMULA AS BELOW
A = 1,100
B= 2,101
C=3,102

THANK YOU & REGARDS
PARTHI
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
If using Excel 2016 (not the stand-alone version) you could try this. It is an array formula so should be entered without the {} but confirmed with Ctrl+Shift+Enter, not just Enter. If confirmed correctly, Excel will insert the {}. The formula can then be copied down. You could then format the column to show the commas.


Excel 2016 (Windows) 32 bit
ABCDE
2a1a1100
3b2b2101
4c3c3102
5d4d4103
6a100
7b101
8c102
9d103
Sheet2 (3)
Cell Formulas
RangeFormula
E2{=TEXTJOIN("",TRUE,IF(A$2:A$9=D2,B$2:B$9,""))+0}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Last edited:
Upvote 0
thank you for your help and we are useing excel 2007 which i could not able to find "TEXTJOIN" function. thanks again
 
Upvote 0
thank you for your help and we are useing excel 2007 which i could not able to find "TEXTJOIN" function. thanks again
No, Excel 2007 does not have TEXTJOIN, that's why I specified Excel 2016.

Is there always 2, and no more than 2, values to join for each value in the first column?
 
Upvote 0
thank you for your support and reply.

it will be more than 2 not more than 20. thank you

for example
a 1
b 2
c 3
d 4
a 100
b 101
c 102
d 103
a test1
b test2
c test3
d test4
a test100
b test101
c test102
d test103


Result
a 1,100,test1,test100

thank you
 
Upvote 0
it will be more than 2 not more than 20.
Then without the TEXTJOIN function it isn't feasible with a worksheet formula. You could try this user-defined function. To implement ..
1. Right click the sheet name tab and choose "View Code".
2. In the Visual Basic window use the menu to Insert|Module
3. Copy and Paste the code below into the main right hand pane that opens at step 2.
4. Close the Visual Basic window.
5. Enter the formula as shown in the screen shot below and copy down.
6. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm)

Code:
Function myConcat(sMatchValue As String, rData As Range) As String
  Dim aData As Variant
  Dim i As Long
  
  aData = rData.Value
  For i = 1 To UBound(aData)
    If aData(i, 1) = sMatchValue Then myConcat = myConcat & "," & aData(i, 2)
  Next i
  myConcat = Mid(myConcat, 2)
End Function


Excel 2016 (Windows) 32 bit
ABCDE
1
2a1a1,100,test1,test100
3b2b2,101,test2,test101
4c3c3,102,test3,test102
5d4d4,103,test4,test103
6a100
7b101
8c102
9d103
10atest1
11btest2
12ctest3
13dtest4
14atest100
15btest101
16ctest102
17dtest103
myConcat
Cell Formulas
RangeFormula
E2=myConcat(D2,A$2:B$17)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,889
Messages
6,122,097
Members
449,065
Latest member
albertocarrillom

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