Google Sheets – Create a Unique Order Number from Existing Column

formulasgoogle sheetsgoogle-sheets-arrayformula

I need to create a unique ID from an existing list of order numbers. Pls see the image below:
enter image description here

What I want is for the existing duplicate order numbers to be made unique by adding an extra digit to the end.

At the moment for about 300 rows with different sets of order numbers, I make numbers form 1-300(or however long the list) & join the order numbers with that manually. That makes the IDs too long.

enter image description here

Pls see this sheet for the examples:
https://docs.google.com/spreadsheets/d/1VENgvRAdBaAC28lpJ5a2QvD5KtnD-S3dx5rUELzvGCM/edit#gid=170066588

I did do some research on this, and what I always get is creating unique IDs from scratch, getting unique numbers from duplicates using UQNIQUE formula or removing duplicates.
I just want to add a digit to the end of each set of order numbers to make that unique.

Best Answer

Please use

=ARRAYFORMULA(IF(LEN(B2:B),B2:B&"-"&COUNTIFS(B2:B,B2:B,ROW(B2:B),"<="&ROW(B2:B)),))

enter image description here

Functions used: