I have on excel file with so many rows. It file contains Product Id Column and Product name column like bellow

I want to add product ID to these products by name using vba(something like cluster). the result should be like this:

note that my original excel file is the first picture
If you can assume that Product name is sorted then in A2 put the value
1and in A3=IF(B2=B3, A2, A2 + 1)and drag down.