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!
 
So in my sample in Post #8 , for A3, A4, A5, those will Not result in 11 digits converted, due to the "numbers" within the first 3 characters, how do you want those "numbers" handled?
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Pad with "0" for 2 digits.

You mean like this?


Book1
ABC
1Emp#
2ALY/56324102134563241021345632
3F66/10194156060101941560601019
4F66/00984156060009841560600098
5J3N/11754193023117541930231175
6123/45674102030456741020304567
7F06/00984150060009841500600098
8
9Result is TextResult is Number
Sheet146
Cell Formulas
RangeFormula
B2=4&IF(ISNUMBER(LEFT(A2,1)+0),LEFT(A2,1)&0,CODE(A2)-55)&IF(ISNUMBER(MID(A2,2,1)+0),MID(A2,2,1)&0,CODE(MID(A2,2,1))-55)&IF(ISNUMBER(MID(A2,3,1)+0),MID(A2,3,1)&0,CODE(MID(A2,3,1))-55)&RIGHT(A2,4)
C2=(4&IF(ISNUMBER(LEFT(A2,1)+0),LEFT(A2,1)&0,CODE(A2)-55)&IF(ISNUMBER(MID(A2,2,1)+0),MID(A2,2,1)&0,CODE(MID(A2,2,1))-55)&IF(ISNUMBER(MID(A2,3,1)+0),MID(A2,3,1)&0,CODE(MID(A2,3,1))-55)&RIGHT(A2,4))+0
 
Last edited:
Upvote 0
If you are using Office 365, try this.

Edit: I've added a marginally shorter formula in column C.

Excel Workbook
ABC
1Emp#
2ALY/56324102134563241021345632
3F66/10194150606101941506061019
4F66/00984150606009841506060098
5J3N/11754190323117541903231175
6123/45674010203456740102034567
7F06/00984150006009841500060098
Convert
 
Last edited:
Upvote 0
Almost but I was thinking F66 = 150606

Well, you didn't specify....


Book1
ABC
1Emp#
2ALY/56324102134563241021345632
3F66/10194150606101941506061019
4F66/00984150606009841506060098
5J3N/11754190323117541903231175
6123/45674010203456740102034567
7F06/00984150006009841500060098
8
9Result is TextResult is Number
Sheet146
Cell Formulas
RangeFormula
B2=4&IF(ISNUMBER(LEFT(A2,1)+0),0&LEFT(A2,1),CODE(A2)-55)&IF(ISNUMBER(MID(A2,2,1)+0),0&MID(A2,2,1),CODE(MID(A2,2,1))-55)&IF(ISNUMBER(MID(A2,3,1)+0),0&MID(A2,3,1),CODE(MID(A2,3,1))-55)&RIGHT(A2,4)
C2=(4&IF(ISNUMBER(LEFT(A2,1)+0),0&LEFT(A2,1),CODE(A2)-55)&IF(ISNUMBER(MID(A2,2,1)+0),0&MID(A2,2,1),CODE(MID(A2,2,1))-55)&IF(ISNUMBER(MID(A2,3,1)+0),0&MID(A2,3,1),CODE(MID(A2,3,1))-55)&RIGHT(A2,4))+0
 
Upvote 0
If you don't have the CONCAT function for the post 15 suggestion, here is a slightly shortened version of jtakw's latest B2 suggestion.

Excel Workbook
AB
1Emp#
2ALY/563241021345632
3F66/101941506061019
4F66/009841506060098
5J3N/117541903231175
6123/456740102034567
7F06/009841500060098
Convert (2)
 
Upvote 0
For those who might want to do something like this using a UDF (user defined function), here one that will work...
Code:
[table="width: 500"]
[tr]
	[td]Function Emp(ID As String) As String
  If Len(ID) Then Emp = 4 & Join(Evaluate("IF({1},TEXT(FIND(MID(""" & ID & """,COLUMN(A:C),1),""0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"")-1,""00""))"), "") & Right(ID, 4)
End Function[/td]
[/tr]
[/table]
 
Upvote 0
Another (shorter) CONCAT formula. This one is an array formula so should be entered without the {} but confirmed with Ctrl+Shift+Enter, not just Enter. If confirmed correctly, Excel will insert the {}. The formula can then be copied down.

Excel Workbook
AB
1Emp#
2ALY/563241021345632
3F66/101941506061019
4F66/009841506060098
5J3N/117541903231175
6123/456740102034567
7F06/009841500060098
Convert (3)
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,190
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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