Search code examples
excelduplicatesserial-number

I want to give same number to the duplicate data in excel


I want to give same number to the duplicate data in excel

 A      B
apple   1
apple   1
apple   1
ball    2
bat     3
dog     4
dog     4
goat    5

Solution

  • Sort your column A then insert the number 1 in cell B2 and the following function in cell B3 and copy down.

    in cell B2=1

    function in cell B3: =if(A3=A2, B2, B2+1)

    Update

    enter image description here