convert cells

wwarneke

New Member
Joined
Jul 9, 2015
Messages
6
Hello Excel guru's, I need to convert the text data in an excel sheet to a fixed length number.
For example:

Emp#
ALY/5632 = 41021345632

In this example, output always starts with "4".
A=10, Z=35 etc
/ is removed

can I do this in one extra column?

Thanks!
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
How does A=10 and Z=35?
What do L and Y get replaced with?
Where is the letter to number conversion chart?
How does ALY get translated to its number? Cocatenate the numerals? or add them? or something else?
 
Upvote 0
Hi,

If your Employee # are Always in the format in your sample:


Book1
ABC
1Emp#
2ALY/5632 = 410213456324102134563241021345632
Sheet146
Cell Formulas
RangeFormula
B2=4&CODE(A2)-55&CODE(MID(A2,2,1))-55&CODE(MID(A2,3,1))-55&RIGHT(A2,4)
C2=(4&CODE(A2)-55&CODE(MID(A2,2,1))-55&CODE(MID(A2,3,1))-55&RIGHT(A2,4))+0


B2 formula results in Text.
C2 formula converts results to Real Numbers.

If you have Employee #s in different formats, please show all possible formats.
 
Upvote 0
My conversion chart will be A=10, B=11, C=12 etc up to Z=35
but that is my question how to convert...
 
Upvote 0
Thanks!
Employee #s are always in this format
F66/1019
F66/0098
J3N/1175

Last 4 digits after / are always numeric
 
Upvote 0
Thanks!
Employee #s are always in this format
F66/1019
F66/0098
J3N/1175

Last 4 digits after / are always numeric

These are Different than the sample in your OP, these are Mixed Alpha/Numeric for the Left 3 characters, your OP was All Alphabetic.

Will post back with updated formula.
 
Upvote 0
These are Different than the sample in your OP, these are Mixed Alpha/Numeric for the Left 3 characters, your OP was All Alphabetic.

Agreed, that will throw my formula for a loop too. But, just for fun, here's what I came up with.

Code:
=4&SUMPRODUCT((CODE(MID(LEFT(A1,FIND("/",A1)-1),ROW(INDIRECT("1:"&FIND("/",A1)-1)),1))-55)*({10000;100;1}))&RIGHT(A1,LEN(A1)-FIND("/",A1))
 
Upvote 0
Assuming the "Numbers" within the Left 3 characters need No conversion, Only Letters gets converted:


Book1
ABC
1Emp#
2ALY/56324102134563241021345632
3F66/1019415661019415661019
4F66/0098415660098415660098
5J3N/117541932311754193231175
Sheet146
Cell Formulas
RangeFormula
B2=4&IF(ISNUMBER(LEFT(A2,1)+0),LEFT(A2,1),CODE(A2)-55)&IF(ISNUMBER(MID(A2,2,1)+0),MID(A2,2,1),CODE(MID(A2,2,1))-55)&IF(ISNUMBER(MID(A2,3,1)+0),MID(A2,3,1),CODE(MID(A2,3,1))-55)&RIGHT(A2,4)
C2=(4&IF(ISNUMBER(LEFT(A2,1)+0),LEFT(A2,1),CODE(A2)-55)&IF(ISNUMBER(MID(A2,2,1)+0),MID(A2,2,1),CODE(MID(A2,2,1))-55)&IF(ISNUMBER(MID(A2,3,1)+0),MID(A2,3,1),CODE(MID(A2,3,1))-55)&RIGHT(A2,4))+0


B2 formula results in Text.
C2 formula results in Real Numbers.
 
Upvote 0
And a VBA solution.

Code:
Function Emp(ID As String) As String
Dim SP()    As String: SP = Split(ID, "/")
Dim P1      As String: P1 = SP(0)
Dim P2      As String: P2 = SP(1)
Dim Ch      As String
Dim Result  As String


Result = 4


For i = 1 To Len(P1)
    Ch = Mid(P1, i, 1)
    If IsNumeric(Ch) Then
        Result = Result & Format(Ch, "00")
    Else
        Result = Result & Asc(Ch) - 55
    End If
Next i


Result = Result & P2


Emp = Result


End Function
 
Upvote 0
Thanks for the help/replies!
Sorry for the lack of clarity in my op, for some reason the forum was hanging really bad in my browser very difficult to type...
Now working better in chrome.
My goal is to take this Emp. list report from QB and convert the emp #'s to an 11 digit number beginning with 4. Will be used to create barcodes for and Emp discount card.
I always used to do stuff like this by convert to csv and use parseOmatic but doing in excel is good experience.
Thanks again
 
Upvote 0

Forum statistics

Threads
1,215,151
Messages
6,123,316
Members
449,094
Latest member
Chestertim

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