Quickly combine same values/data or duplicate rows in Excel
Kutools for Excel
Boosts Excel With 300+
Powerful Features
Suppose you are working with a data set that contains duplicate records in a column, and now you need to combine rows based on the same values in that column and perform some operations (such as merging, calculating) on the cells in the same row of other columns. The Advanced Combine Rows feature of Kutools for Excel can help you solve this problem. With this feature, you can easily achieve:
Combine rows with same values and merge the values of other columns
Combine duplicate rows and sum/count values of other columns
Combine duplicate rows and keep the first or last data of other columns
Click Kutools > Merge & Split > Advanced Combine Rows to enable this feature. See screenshot:
Combine rows with same values and merge the values of other columns
As shown in the screenshot below, this is a sales table containing customers and their corresponding orders in different columns. You can see in the table that the same customer made multiple purchases. Our goal is to merge the purchases of the same customer into one row, separate by commas. Let's see how to handle this task with the Advanced Combine Rows feature.
1. Select the entire table (A1:B13 in this case), go to select Kutools > Merge & Split > Advanced Combine Rows to enable this feature.
2. In the Advanced Combine Rows dialog box, you need to configure as follows.
In this case, as I need to combine rows based on duplicate values in the Customer column, here I select Customer in the list, click the arrow in the Operation column, and then select Primary Key from the drop-down menu;
Here I select the column Product, click the arrow in the Operation column, and then select Comma in the Combine group from the drop-down menu.
3. Then another Advanced Combine Rows dialog box pops up, showing how many rows will be successfully merged. Click OK to close it.
After merging, you can see the result as follows.
Combine duplicate rows and sum/count values of other columns
As shown in the screenshot below, this is a sales table containing customers and their corresponding orders and sales in different columns. You can see in the table that the same customer made multiple purchases. Our goal is to merge the purchases of the same customer into one row and calculate the total amount for each customer separately.
1. Select the entire table (A1:C13 in this case), go to select Kutools > Merge & Split > Advanced Combine Rows to enable this feature.
2. In the Advanced Combine Rows dialog box, you need to configure as follows.
In this case, as I need to combine rows based on duplicate values in the Customer column, here I select Customer in the list, click the arrow in the Operation column, and then select Primary Key from the drop-down menu;
Here I select the column Product, click the arrow in the Operation column, and then select a delimiter you want to use to separate the values (here I select Comma).
In this case, I need to sum the sales for the same customer. Here I select Sale in the list, click the arrow in the Operation column, and then select Sum in the Calculate group from the drop-down menu.
3. Then another Advanced Combine Rows dialog box pops up, showing how many rows will be successfully merged. Click OK to close it.
After merging, you can see the result as follows.
Combine duplicate rows and keep the first or last data of other columns
As shown in the screenshot below, this is a sales table containing customers and their corresponding orders and purchase dates in different columns. You can see in the table that the same customer made multiple purchases. Our goal is to merge the purchases of the same customer into one row, keeping only the first purchase date in the Date column.
1. Select the entire table (A1:C13 in this case), go to select Kutools > Merge & Split > Advanced Combine Rows to enable this feature.
2. In the Advanced Combine Rows dialog box, you need to configure as follows.
In this case, as I need to combine rows based on duplicate values in the Customer column, here I select Customer in the list, click the arrow in the Operation column, and then select Primary Key from the drop-down menu;
Here I select the column Product, click the arrow in the Operation column, and then select a delimiter you want to use to separate the values (here, I select Comma).
In this case, I want to keep only the first purchase date for each customer. Here I select Date in the list, click the arrow in the Operation column, and then select Keep 1st data of column in the Keep group from the drop-down menu.
3. Then another Advanced Combine Rows dialog box pops up, showing how many rows will be successfully merged. Click OK to close it.
After merging, you can see the result as follows.
Notes:
1. This feature supports Undo (Ctrl + Z);
2. This function does not work for filtering data.
Productivity Tools Recommended
The following tools can greatly save your time and money, which one is right for you?
Office Tab: Using handy tabs in your Office, as the way of Chrome, Firefox and New Internet Explorer.
Kutools for Excel: More than 300 Advanced Functions for Excel 2021, 2019, 2016, 2013, 2010, 2007 and Office 365.
Kutools for Excel
The functionality described above is just one of 300 powerful functions of Kutools for Excel.
Designed for Excel(Office) 2021, 2019, 2016, 2013, 2010, 2007 and Office 365. Free download and use for 30 days.
The following tools can greatly save your time and money, which one is right for you?
Office Tab: Using handy tabs in your Office, as the way of Chrome, Firefox and New Internet Explorer.
Kutools for Excel: More than 300 Advanced Functions for Excel 2021, 2019, 2016, 2013, 2010, 2007 and Office 365.
Kutools for Excel
The functionality described above is just one of 300 powerful functions of Kutools for Excel.
Designed for Excel(Office) 2021, 2019, 2016, 2013, 2010, 2007 and Office 365. Free download and use for 30 days.