Is there a function conditionally to concatenate cells and delete certain rows? <p>I have an Excel sheet with data arranged like this: </p> <p><img src="https://i.stack.imgur.com/CdFB4.gif" alt="SO21289587 question first example"></p> <p>For every row of column A that repeats (by necessity as the database is arranged alphabetically) I need to concatenate the number for the repeating row from column B into the cell above it (inserting, say, a comma between the two strings). Then I need to delete the repeating row to end up with the following: </p> <p><img src="https://i.stack.imgur.com/mbv4S.gif" alt="SO21289587 question second example"> </p> <p>Breaking this down:</p> <ol> <li>In column A, identify a row that is a copy of the row above it.</li> <li>Concatenate the information from column B of the repeated row into the original row, column B.</li> <li>Delete the repeated row. </li> <li>Repeat until a blank cell is encountered. </li> </ol> <p>I hope someone will advise me on the possibility of producing a function that would execute these actions. I'm looking for a push in the right direction or confirmation that it isn't possible, rather than someone to solve the issue for me.</p>