Home > Enterprise >  Excel CONCAT Columns B and C While they have Similar Values at Column A
Excel CONCAT Columns B and C While they have Similar Values at Column A

Time:10-19

Can you please let me know how I can CONCAT two Columns values while the Column A has similar values in each rows in excel? Something like following, what I need is to CONCAT values of rows in Columns B and C while the A is similar

enter image description here

CodePudding user response:

Assuming you are on Excel 365 and have use of FILTER() and TEXTJOIN(), you can enter the following formula into column D and drag down:

=IF(COUNTIF($A$1:A1,A1)=1,TEXTJOIN(":",TRUE,FILTER($B$1:$C$15,$A$1:$A$15=A1)),"")

This checks if the value in column A is the first occurrence of that value. If it is, it will output a colon delimited string of every value in columns B:C where col A equals the current value in column A.

CodePudding user response:

you can use if command

if cellA1<>cellA2 then you concatenate b2 and C2 else you concatenate D2 and B2, and C2.

CodePudding user response:

You can use a helper column to do this but you need to have a header row for this to work. Assuming your first row of data is in A2, B2, C2:

  1. paste this into D2:

    =IF(A2=A1,D1&","""&B2&""":"""&C2&"""",""""&B2&""":"""&C2&"""")

  2. and paste this into E2:

    =IF(A2=A3,"",D2)

  3. Copy these two down to every row in the data.

Note: This version puts the concatenated result in D at the last row of the group instead of at the first row of the group like your screenshot shows.

  • Related