user3187469
user3187469

Reputation: 1521

Combine Multiple Cells into one and seperate text by comma

So I have these tables as you can see below, each in it's own cell. My questions is, what is the easiest way to combine all cells in each row into one cell, and seperate text by comma.

So for example I would like to achieve in A1 and same for others:

Entry ID,Contest Name,Contest ID,Entry Fee,PG,SG,SF,PF,C,G,F,UTIL



> Entry ID  Contest Name    Contest ID  Entry Fee   PG  SG  SF  PF  C   G   F   UTIL
>     372085759 NBA $10K Quarter Arcade [Just $0.25!]   22552804    $0.25   6444834 6444876 6444974 6445030 6445047 6444918 6445025 6445083
>     372085760 NBA $10K Quarter Arcade [Just $0.25!]   22552804    $0.25   6444832 6444868 6444939 6444986 6445083 6444878 6445022 6444853
>     372085761 NBA $10K Quarter Arcade [Just $0.25!]   22552804    $0.25   6444821 6444911 6444974 6445000 6445068 6444856 6444938 6444909
>     372085762 NBA $10K Quarter Arcade [Just $0.25!]   22552804    $0.25   6444856 6444885 6444938 6445001 6445081 6444867 6445005 6445083
>     372085763 NBA $10K Quarter Arcade [Just $0.25!]   22552804    $0.25   6444821 6444876 6444929 6445030 6445083 6444844 6445025 6444853

Upvotes: 0

Views: 3158

Answers (2)

tc_NYC
tc_NYC

Reputation: 302

You can create an excel UDF to concatenate a comma to each of the cells:

Function addCommas(myRange As Range) As String

addCommas = ""

For Each cell In myRange

    addCommas = addCommas & cell.Value & ", "

Next cell

End Function

Just write the addCommas function on a column on the right and point at the columns you want to concat a comma to.

Upvotes: 0

VBA Pete
VBA Pete

Reputation: 2666

You can use CONCATENATE, e.g. =CONCATENATE(field1,",",field2,",",field3,...), which field1 being the Entry ID, field2 being the Contest name, field3 being the Contest ID and so on.

Upvotes: 2

Related Questions