Generate ID's, difficult request.

DasOliver

New Member
Joined
Jul 4, 2012
Messages
10
Can someone help me get a way to generate ID's by avoiding duplicates and permanent values, unless changed manually.

Lets say I have:
ABCDEF
1CountryStateCitySubmarketUseID
2MexicoBaja CaliforniaTijuanaFloridoIndustrialMBTFI-0001
3MexicoBaja CaliforniaTijuanaFloridoIndustrialMBTFI-0002
4MexicoBaja CaliforniaTijuanaPacificoIndustrialMBTPI-0001
5MexicoBaja CaliforniaTijuanaPacificoIndustrialMBTPI-0002
6MexicoBaja CaliforniaTijuanaPacificoComercialMBTPC-0001
7MexicoBaja CaliforniaTijuanaPacificoRetailMBTPR-0001
8MexicoBaja CaliforniaTijuanaPacificoRetailMBTPR-0002
9MexicoBaja CaliforniaTijuanaPacificoRetailMBTPR-0003
10USACaliforniaSan DiegoOtayRetailUCSOR-0001
11USACaliforniaSan DiegoOtayRetailUCSOR-0002
12USACaliforniaSan DiegoOtayRetailUCSOR-0003
13BoliviaCapitalLa PazCentroIndustrialBCLCI-0001
14BoliviaCapitalLa PazCentroIndustrialBCLCI-0002

<tbody>
</tbody>


I wrote column F, but my need is to populate automatically this column with a formula.

The formula must:
- renew numbering each time that any of the first 5 characters change; look at the sequence above, 0001, 0002, 0003 then on new characters it initiates again on 0001.
- Formula must not allow duplicate ID'S
- It would be ideal if the the formula can display the following sequenced number or those values that have been erased or moved because the status of the property changed.
- values must be permanent once inserted, it would be interconnected with other sheets and perhaps other software, so values can not be changed if a new row is inserted.

The above criteria will solve my needs, i will appreciate a lot if somebody has the knowledge of providing this formula to me.

Best regards,
Oliver
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
I think this should do it

Code:
=left(a2,1)&left(b2,1)&left(c2,1)&left(d2,1)&left(e2,1)&"-"&rept("0",4-len(countifs($a$2:a2,a2,$d$2:d2,d2,$e$2:e2,e2)))&countifs($a$2:a2,a2,$d$2:d2,d2,$e$2:e2,e2)
 
Upvote 0
Or I guess if you really want to be thorough then it should look like this.

=LEFT(A2,1)&LEFT(B2,1)&LEFT(C2,1)&LEFT(D2,1)&LEFT(E2,1)&"-"&REPT("0",4-LEN(COUNTIFS($A$2:A2,A2,$B$2:B2,B2,$C$2:C2,C2,$D$2:D2,D2,$E$2:E2,E2)))&COUNTIFS($A$2:A2,A2,$B$2:B2,B2,$C$2:C2,C2,$D$2:D2,D2,$E$2:E2,E2)
 
Upvote 0
Ok so you said that you typed in the values in column F? I could be wrong but try this:

In column F, maintain only the Text part i.e. MBTFI, UCSOR etc...then in column G try this formula: =F1&" - "&0&COUNTIF($F$1:F1,F1)
 
Upvote 0
Thank you so much, it worked! I tried to get a formula for several days and today it happened! thanks again, I really appreciate your help!
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,857
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top