Creating consistent login IDs with one formula

jodeyes

New Member
Joined
Nov 21, 2016
Messages
23
I get data from various sources and have to create user login IDs that are consistent. I would like help getting one formula (not a macro) that will create the correct ID for all of the different scenarios. Here are more details:

User ID requirements:
  • All numbers (no letters or other characters)
  • 8 digits
  • First 2 digits are the site Location ID
  • Other 6 digits are taken from the Employee ID
  • When EmpID is less than 6 digits, we fill with zeroes to make up the 8 digits
  • When EmpID is more than 6 digits, we take the right-most digits
  • We ignore dashes and letters and follow the above rules.

I have formulas for all of these scenarios, but don't know how to combine them into one.

Location ID: 32
Employee ID What User ID should be
123456 32123456
8-928-664 32928664
8-951-1443 32511443
9771 32009771
10029 32010029
1384991 32384991
CCI36874 32036874

(Hope this is understandable - I couldn't get the tables to work right and cannot attach.)

Thank you in advance!
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
If you have the CONCAT function in your version of Excel, then maybe:

AB
1Location ID32
212345632123456
38-928-66432928664
48-951-144332511443
5977132009771
61002932010029
7138499132384991
8CCI3687432036874

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet4

Array Formulas
CellFormula
B2{=$B$1&RIGHT(TEXT(CONCAT(IFERROR(MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1)+0,""))+0,"000000"),6)}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>
 
Upvote 0
If you don't have 'Concat' available, then this should do it. Use a helper column. This formula can be used to extract the numerical portion of the Employee ID in Column A. I put this formula in E1. This one is an array formula so, 'Ctrl+Shift+Enter' after pasting the formula.

Code:
=SUMPRODUCT(MID(0&A1,LARGE(INDEX(ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))* ROW(INDIRECT("1:"&LEN(A1))),0),ROW(INDIRECT("1:"&LEN(A1))))+1,1)*10^ROW(INDIRECT("1:"&LEN(A1)))/10)

Then I put the following formula in F1 to generate the User ID.

Code:
=32&IF(LEN(E1)<6,REPT("0",6-LEN(E1))&E1,RIGHT(E1,6))

Then you can just copy the formulas down.
 
Upvote 0
Hi,

If the possible Alphabets/Letters in the Employee ID are Always on the Left, then this would work:


Book1
AB
1Location ID32
2Employee IDUser ID
312345632123456
48-928-66432928664
58-951-144332511443
6977132009771
71002932010029
8138499132384991
9CCI3687432036874
Sheet161
Cell Formulas
RangeFormula
B3=B$1&TEXT(RIGHT(SUBSTITUTE(MID(A3,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A3&"0123456789")),255),"-",""),6),"000000")
 
Upvote 0
Thank you, Eric W. My audience cannot handle the Ctrl+Shift+Enter, but I am going to note this for a future project.
 
Upvote 0
Thank you, lrobbo314. My audience cannot handle the Ctrl+Shift+Enter, but I am going to note this for a future project.
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,588
Members
449,174
Latest member
chandan4057

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