Combining Excel Rows Into One Row..

So I have the following data example in three consecutive rows:

Tom, Kansas, 321 N B, University
Tom, Kansas, 321 N B, University, Wichita
Tom Farrow, Kansas, 321 N B, Kansas University

I'd like to have one row that eliminates duplication.  It would look like this (knowing there is still some duplication due to similar, but different naming conventions between the commas).

Tom, Tom Farrow, Kansas, 321 N B, Kansas University, University, Wichita

Will an Excel function do this?  Thanks.  - Tom
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
I'm not sure if it could be done via a formula but here's a macro you can use.

Sub CombineNames()
Dim lngLastRow As Long
Dim lngRow As Long
Dim strParts() As String

lngLastRow = Range("A1048576").End(xlUp).Row

For lngRow = lngLastRow To 1 Step -3
    strParts = Split(Cells(lngRow - 1, 1), ", ")
    Cells(lngRow - 2, 1) = strParts(0) & ", " & Cells(lngRow, 1) & ", " & strParts(UBound(strParts))
    Cells(lngRow, 1).EntireRow.Delete
    Cells(lngRow - 1, 1).EntireRow.Delete
End Sub

Open in new window

Just in case you need them, here are instructions on how to install and use the macro.

In Excel, Press Alt+F11 to open the Visual Basic Editor (VBE)

Right-click on your workbook name in the "Project-VBAProject" pane (at the top left corner of the editor window). If you don’t see an existing module then select Insert -> Module from the context menu. Otherwise just select the module.

Copy the macro (you can use the ‘Select All’ button if you like) and paste it into the right-hand pane of the VBA editor ("Module1" window)

Press Alt+F11 again to go back to Excel

Optionally, press Alt+F8 to open the "Macro" dialog window. Select the macro, click ‘Options…’,  hold down the Shift key and type the letter A (or any other letter) and click ‘OK’. Then anytime you want to run the macro press Ctrl+Shift+A.

When you close the workbook you will need to save it as an xlsm or xls file if it’s not already one of those.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tomfarrarAuthor Commented:
Thanks, Martin. that works darn well.  - Tom
tomfarrarAuthor Commented:
Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015, Experts-Exchange Top Expert Visual Basic Classic 2012 to 2014
tomfarrarAuthor Commented:
I'll check the articles out!  Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.