-1

Require help with Concatenateif function

I have data on Column A & Column B - for all the unique values in Column A

I am looking to concatenate the corresponding values in Column B and then the result to be displayed in Column C

for Example: C2 is the Concatenated value of B1 & B2 separated by Commas

C5 is the Concatenated value of B5 to B7 separated by Commas

enter image description here

Community
  • 1
  • 1
blk_sas
  • 29
  • 5
  • The question as written is not clear in terms of what you want as a *result* of the input you have provided. That said, it's very possible a formula will work more easily than VBA code. – Scott Holtzman Sep 13 '16 at 11:03
  • What version of Excel? Excel 2016 has the TEXTJOIN function. @ScottHoltzman OP wants to join the Products for each Supplier. For example `103, 680, 241` in `C2` – Slai Sep 13 '16 at 11:18
  • i don't think amendment required on the useful code u found, its quite universal already – Rosetta Sep 13 '16 at 11:19
  • try use it, if only u have an error, then only ask the error here – Rosetta Sep 13 '16 at 11:20
  • So what do you have so far? – Preston Sep 13 '16 at 11:31
  • I have found this code - however wondering where condition should be input or changed http://www.exceltips.nl/concatenateif-function-for-excel/ – blk_sas Sep 13 '16 at 11:52
  • Also, in the future make sure you post your sample data in the post and not a picture. A lot of people can't see it because the image host gets blocked. – SandPiper Sep 13 '16 at 12:25

1 Answers1

0

with this oversimplified UDF:

Public Function join(Delimiter, values)
    For Each value In values
        If value > "" Then
            If join > "" Then join = join & Delimiter
            join = join & value
        End If
    Next
End Function

you can use an array formula like this:

{=join(",",IF(A2:A5=A2,B2:B5,""))}

or with some of the TEXTJOIN UDF substitutes:

{=TEXTJOIN(",",TRUE,IF(A2:A5=A2,B2:B5,""))}
Slai
  • 22,144
  • 5
  • 45
  • 53