Re: How to generate a unique ID
Here's the most efficient way I can think of doing it without using VBA to parse the text to find the capitalised letters.
You mentioned the reference text is from a validation list, so create a helper column next to the validation source with the following array formula (you could do it next to every item in your data but array formulas are slow and processor intensive if you have lots of them). The formula assumes the first letter of the reference string is one you want and then includes the next capitalised letter as well. You can then use COUNTIF to find out how many occurrences of the same reference text have appeared previously and use CONCATENATE and TEXT to format the two values as you require into your unique ID column.
The array formula is: {=LEFT(E2,1)&MID(E2,SMALL(FIND(0,SUBSTITUTE(E2,CHAR(ROW(INDIRECT("65:90"))),0)&0),2),1)}
(enter this with control,shift,enter and do not type in the curly braces)
The formula to reference this in your output column should be the following, which can be copied down as far as needed: =CONCATENATE(VLOOKUP(B2,refName,2,FALSE),"-",TEXT(COUNTIF($B$2:B2,B2),"000"))
(where B2 is the first text cell; you will also need to change the first range cell in the COUNTIF depending on where your data starts, I've named the data validation area "refName" for clarity)
Here's an example file which hopefully makes more sense. I hope it helps.
UniqueID.xlsx
Excel
Video Tutorials / Excel Dashboards Reports
Bookmarks