Require formula

Ron99

Active Member
Joined
Feb 10, 2010
Messages
347
Office Version
  1. 2016
Platform
  1. Windows
[TABLE="width: 500"]
<tbody>[TR]
[TD]ID

[/TD]
[TD]CODE
[/TD]
[TD]OUTPUT
[/TD]
[/TR]
[TR]
[TD]001
[/TD]
[TD]AM
[/TD]
[TD]AM,AS,PA
[/TD]
[/TR]
[TR]
[TD]001
[/TD]
[TD]AS
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]001
[/TD]
[TD]PA
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]002
[/TD]
[TD]ZE
[/TD]
[TD]ZE
[/TD]
[/TR]
[TR]
[TD]003
[/TD]
[TD]RO
[/TD]
[TD]RO,IH
[/TD]
[/TR]
[TR]
[TD]003
[/TD]
[TD]IH
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I require formula for the above data, I have typed the output that I require, I require formula the output column

Thanks,
Ron
 
Last edited:

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Assuming that TEXTJOIN is available on your Excel system...

In C2 control+shift+enter, not just enter, and copy down:

=IF(ISNA(MATCH(A2,$A$1:A1,0)),TEXTJOIN(",",TRUE,IF($A$2:$A$7=A2,$B$2:$B$7,"")),"")
 
Upvote 0
Hi,

I am using excel 2016, TEXTJOIN function does not show up.
 
Upvote 0
Hi,

I am using excel 2016, TEXTJOIN function does not show up.

In that case:

If the native function TEXTJOIN is not available on your system...

In C2 control+shift+enter, not just enter, and copy down:

=IF(ISNA(MATCH(A2,$A$1:A1,0)),REPLACE(aconcat(IF($A$2:$A$7=$A2,", "&$B$2:$B$7,"")),1,1,""),"")

For this formula to work, add the following code for ACONCAT as a Module to your workbook using Alt+F11...

Function aconcat(a As Variant, Optional sep As String = "") As String
' Harlan Grove, Mar 2002
Dim y As Variant
If TypeOf a Is Range Then
For Each y In a.Cells
aconcat = aconcat & y.Value & sep
Next y
ElseIf IsArray(a) Then
For Each y In a
aconcat = aconcat & y & sep
Next y
Else
aconcat = aconcat & a & sep
End If
aconcat = Left(aconcat, Len(aconcat) - Len(sep))
End Function
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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