Generate Numbers for the Same Group of Data



The data of the Excel file book1.xlsx is shown in the figure below:


The task is to renumber the UNIQUE ID. If IDs are the same, the numbers will be the same, and the number of different IDs will be different. The result is shown in the following figure:


Write SPL script:




2,'UNIQUE ID'=a))



A1 Read book1.xlsx data

A2 After grouping by ID, loop each group, assign each group's serial number # to variable a, and loop each record in the group, making UNIQUE ID'=a

A3 Save the table sequence in A1 to the file book2.xlsx