You are here:

Excel/Merging duplicate cells



I am trying to collapse duplicates into single cells, like this two column example:

IN12345678 ABC
IN12345678 XYZ
IN55544457 123
IN57855687 456

With the end result:

IN12345678 ABC, XYZ
IN55544457 123
IN57855687 456

Is there an easy way to do this?



Not sure if its an easy way, but  try this--
First separate the values using text to columns.  you should end up with the 10 place number in one cell and the related second part of the number in the next column on the same row.
for example
IN12345678 ABC in column A  will end up as.

Column B IN12345678
column C ABC

Sort the data on bolumn B so that the column B values are all grouped.

now create a formula in column D (same row, row 1) like this

In the next column column E (same row), create a formula like this

In the next column, column F (same row), create a formula like this

This takes care of a four duplicate number if you will have more then continue on in columns to the right until you have created formulas to take care of all of the duplicates.

Then use a combining formula to combine the values in each of the columns something like this--

The result of the combining formula will look something like this

These formulas will all copy down and with the relative referencing will change appropriately.

You will now end up with one row which has all of the duplicates combined in a formula the other duplicate rows will not have all of the duplicates reflected.

I suggest that you copy and paste special/value, your results, then sor the results in reverse column order which will break out the matches you need.

Hope this helps

About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Richard Roberts


Can assist you in most areas of Excel, have been working with it for about 15 years in many types of applications, but primarily in financial and accounting applications. I am a CPA and many client or client problems have necessitated the use of excel. I am not an expert in charting, macros, or pivot tables.


Have been working with Excel for about 20 years primarily in accounting and financial areas.

BA, Certified Public Accountant

©2017 All rights reserved.