Formula that will generate unique ID based on text data in multiple columns

Monologue

New Member
Joined
Jun 28, 2017
Messages
10
Hi all,



We have a document in work that is used to record design tasks. Each new job can have multiple lines in the document but should all share one unique ID. The document contains about 20 columns but only the below 5 will impact the data that should create the Job ID. Currently, the 'JOB ID' column uses a unique number created by another department. We want to get away from that and use our own number, for numerous reasons. The current system does not take in to account any of the below data, which is what we want to do with the new system. The job id should follow the following structure: 'DATE ASSIGNED' + 'BUYER' + 'SUPPLIER', where 'HANDLER' and 'SUPPLIER' are represented by a code that should be located in a second sheet called 'Lists'. The code for the handler should take the first and last letter of the name and the supplier code should simply be a sequential number based on the supplier's position in the column on the second sheet 'Lists'. So in the first example, the '0138' at the end simply refers the fact that this particular supplier is number 138 in the list. Is what I have described here possible and have you any ideas as to what the formula would look like? I have a column next to the 'SUPPLIER' column in the 'Lists' sheet that contains the sequential numbers. Many thanks for reading and if you need any further explanations / information, please let me know!



STATUSJOB IDDATE ASSIGNEDSUPPLIERHANDLER
Assigned200617MS013820 June 2017ABC 01Marcus
In Progress280617ML025028 June 2017ABC 02Michael
In Progress280617AA011128 June 2017ABC 03Angela
Completed100617ID013810 June 2017ABC 01Ingrid
Assigned050517ML00635 June 2017ABC 04Michael

<tbody>
</tbody>
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Re: Help with formula that will generate unique ID based on text data in multiple columns

STATUSJOB IDDATE ASSIGNEDSUPPLIERHANDLER
Assigned200617Msgn20-06-17greenMarcus
In Progress280617Mlrd28-06-17redMichael
In Progress280617Aabe28-06-17blueAngela
Completed100617Idgn10-06-17greenIngrid
Assigned050617Mlpk05-06-17pinkMichael
B2
=LEFT(TEXT(C2,"dd-mm-yy"),2)&MID(TEXT(C2,"dd-mm-yy"),4,2)&RIGHT(TEXT(C2,"mm-dd-yy"),2)&LEFT(E2,1)&RIGHT(E2,1)&LEFT(D2,1)&RIGHT(D2,1)
not sure why you want a serial number as well
would Marcus have another green job on the same date ?

<colgroup><col><col><col><col><col span="9"></colgroup><tbody>
</tbody>
 
Upvote 0
Re: Help with formula that will generate unique ID based on text data in multiple columns

Thanks Oldbrewer. For the Supplier name, we want to use the full number, rather than the 1st and 2nd letter/digit as per your formula. Knowing this - how would that change the formula?

Thanks!
 
Upvote 0
Re: Help with formula that will generate unique ID based on text data in multiple columns

STATUSJOB IDDATE ASSIGNEDSUPPLIERHANDLER
Assigned200617Msgreen20-06-17greenMarcus
In Progress280617Mlred28-06-17redMichael
In Progress280617Aablue28-06-17blueAngela
Completed100617Idgreen10-06-17greenIngrid
Assigned050617Mlpink05-06-17pinkMichael
B2
=LEFT(TEXT(C2,"dd-mm-yy"),2)&MID(TEXT(C2,"dd-mm-yy"),4,2)&RIGHT(TEXT(C2,"mm-dd-yy"),2)&LEFT(E2,1)&RIGHT(E2,1)&D2
not sure why you want a serial number as well
would Marcus have another green job on the same date ?

<colgroup><col><col><col><col><col span="7"></colgroup><tbody>
</tbody>
 
Upvote 0
Re: Help with formula that will generate unique ID based on text data in multiple columns

not sure why you want a serial number as well
would Marcus have another green job on the same date ?

<tbody>
</tbody>

Hi Oldbrewer,

I'm not sure what you mean with "why you want a serial number as well"? The handlers and suppliers all cross over so yes, it's very likely that Marcus and Ingrid may be working on two different orders with the same supplier, on the same day. And it's also possible for Marcus to open a job with green on the same day. In this case, because I control the 'Assigned Date' I would simply choose a different day to assign the job. I will give this code a try and let you know how I get on.

Thanks again!
 
Upvote 0
Re: Help with formula that will generate unique ID based on text data in multiple columns

STATUSJOB IDDATE ASSIGNEDSUPPLIERHANDLERCDECOUNTOFCDE
Assigned200617Msgreen120-06-17greenMarcus20-06-17greenMarcus1
In Progress280617Mlred128-06-17redMichael28-06-17redMichael1
In Progress280617Aablue128-06-17blueAngela28-06-17blueAngela1
Completed100617Idgreen110-06-17greenIngrid10-06-17greenIngrid1
Assigned050617Mlpink105-06-17pinkMichael05-06-17pinkMichael1
Assigned200617Msgreen220-06-17greenMarcus20-06-17greenMarcus2
B2
=LEFT(TEXT(C2,"dd-mm-yy"),2)&MID(TEXT(C2,"dd-mm-yy"),4,2)&RIGHT(TEXT(C2,"mm-dd-yy"),2)&LEFT(E2,1)&RIGHT(E2,1)&D2&G2
if you can tolerate helper columns F and G you now have a unique ID generator
note I added the last row identical to the first
CDE is a concatenation
=TEXT(C2,"dd-mm-yy")&D2&E2
note date converted to text

<colgroup><col><col><col><col><col><col><col><col span="2"></colgroup><tbody>
</tbody>
 
Upvote 0
Re: Help with formula that will generate unique ID based on text data in multiple columns

if you can tolerate helper columns F and G you now have a unique ID generator
note I added the last row identical to the first
CDE is a concatenation
=TEXT(C2,"dd-mm-yy")&D2&E2
note date converted to text

<tbody>
</tbody>

Can I place columns F and G in a separate sheet within the workbook or do they have to be in the same sheet?
 
Upvote 0
Re: Help with formula that will generate unique ID based on text data in multiple columns

Quick follow on question - in this document, as explained, I have two sheets: 'Projects' and 'Lists'. The 'lists' sheet is used for lists that are referenced in pop-down lists in 'Projects' (which is the main sheet that's used). In the lists sheet, I have a column with all suppliers, listed (in no order) by name. I would like to add a column next to this, with a short numerical code, generated from the name in the supplier column. For example, supplier "Balloons Inc." becomes '0123'. This code, 0123, is then used to make up the final job id, instead of the full supplier name. So what I want to do is create unique numbers/codes from the names of the suppliers (it can be as simple as sequential, doesn't matter as long as it's unique), and reference these numbers in the 'Projects' sheet and use this number/code to form part of the final job id. I hope I have explained myself properly, but feel free to let me know if I haven't!

Thanks.
 
Upvote 0
Re: Help with formula that will generate unique ID based on text data in multiple columns

Hi Oldbrewer,

I am getting a #VALUE! error code with the formula(s) above. Any ideas? I've typed your formula to the letter, except for when the letter of the column was different from yours above, but that wouldn't have any bearing on the final result I would have thought? Some of the columns do use in-cell drop downs with data from the second sheet, 'Lists'. For example, instead of the Supplier column in the example above I have a column next to it with the following formula: =LEFT(H2, 4) which converts the full supplier name to a 'code' of the first 4 letters. So, is using this data giving me the error?

Thanks!
 
Upvote 0
Re: Help with formula that will generate unique ID based on text data in multiple columns

it shouldn't as in the case of green it will be gree

to reference a cell in sheet lists the format is =lists!A1
 
Upvote 0

Forum statistics

Threads
1,215,209
Messages
6,123,646
Members
449,111
Latest member
ghennedy

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