简体   繁体   中英

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

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

在此处输入图片说明

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.

you can use if command

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM