Question

I have this table:

NAME1
NAME1
NAME1
NAME1
NAME2
NAME2
NAME2

and need to end up with this

NAME1_A1
NAME1_A2
NAME1_A3
NAME1_A4
NAME2_A1
NAME2_A2
NAME2_A3

So basically I need to find all the cells that match exactly each other. In this case I would find "NAME1" and then I need to add "_A1" to "_Ax" where x is same as count of found matches. Then it needs to find another match and do the same. So for NAME2 , add A1 - Ax as well.

I was trying to begin with recording macro and then editing it. Afterwards I have tried to write this on my own, however, my I have to admit that I don't even know how to start. Anyone to help ?

Was it helpful?

Solution

Suppose you have your data in column A starting in cell A1.

In cell B1, put in the following formula:

=A1 & "_A" & COUNTIF($A$1:A1,A1)

Then drag it down.

Now, just Copy and Paste Special > Values on top of your original column and you're done - Then you can delete out the calculation column.

Hope that makes sense.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top