I want to give same number to the duplicate data i

2019-09-08 09:46发布

问题:

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

回答1:

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