Etract numbers from a string of 13 digits into 5 separate cells

Kazdima

Board Regular
Joined
Oct 15, 2010
Messages
226
Hello,
i need do extract digits from One cell into 5 separate.
ABCDE F
2digits3digits1digit3digits4digits13digits string
01259631075100125963107510
Note: "Zero" can be in any part of new strings. Not to lose it.

<colgroup><col style="mso-width-source:userset;mso-width-alt:2706;width:56pt" width="74"> <col style="width:48pt" width="64" span="4"> <col style="mso-width-source:userset;mso-width-alt:4352;width:89pt" width="119"> </colgroup><tbody>
</tbody>

Thank you for a help with a formula, and/or Macro.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hi,

Will this work for you:


Excel 2010
ABCDEF
12digits3digits1digit3digits4digits13digits string
201259631075100125963107510
Sheet14
Cell Formulas
RangeFormula
A2=LEFT(F2,2)
B2=MID(F2,3,3)
C2=MID(F2,6,1)
D2=MID(F2,7,3)
E2=RIGHT(F2,4)
 
Upvote 0
Here's an alternative where the number of digits you want to extract is in row 1.

Excel Workbook
ABCDEF
123134
201259631075100125963107510
Sheet3
 
Upvote 0
And if OP can add a Blank column in front, one formula can do all five:


Excel 2010
ABCDEFG
5digitsdigitsdigitsdigitsdigits
62313413digits string
701259631075100125963107510
Sheet14
Cell Formulas
RangeFormula
B7=MID($G7,SUM($A6:A6,1),B6)


B7 formula copied across to F7
 
Last edited:
Upvote 0
And if OP can add a Blank column in front, one formula can do all five:


Excel 2010
ABCDEFG
5digitsdigitsdigitsdigitsdigits
62313413digits string
701259631075100125963107510
Sheet14
Cell Formulas
RangeFormula
B7=MID($G7,SUM($A6:A6,1),B6)


B7 formula copied across to F7
If your worksheet is listing the number of digits per cell as jtakw has assumed above, then use his formula. However, if you are not listing the digit count on the worksheet directly, then you can use the following single formula. With your number in cell F2, put this formula in cell A2 and copy it across to cell E2...

=MID($F2,LOOKUP(COLUMNS($A:A),{1,2,3,4,5},{1,3,6,7,10}),LOOKUP(COLUMNS($A:A),{1,2,3,4,5},{2,3,1,3,4}))
 
Upvote 0
If your worksheet is listing the number of digits per cell as jtakw has assumed above, then use his formula. However, if you are not listing the digit count on the worksheet directly, then you can use the following single formula. With your number in cell F2, put this formula in cell A2 and copy it across to cell E2...

=MID($F2,LOOKUP(COLUMNS($A:A),{1,2,3,4,5},{1,3,6,7,10}),LOOKUP(COLUMNS($A:A),{1,2,3,4,5},{2,3,1,3,4}))
This is probably a more straightforward formula to use...

=MID($F2,CHOOSE(COLUMNS($A:A),1,3,6,7,10),CHOOSE(COLUMNS($A:A),2,3,1,3,4))
 
  • Like
Reactions: ISY
Upvote 0
Hi!

Another way (with JoeMo's layout). In A2 and copy to the right

=LEFT(REPLACE($F2,1,SUM($A1:$E1)-SUM(A1:$E1),""),A1)

Markmzz
 
Last edited:
Upvote 0
. formula, and/or Macro.
Assuming data starting in F2 you could also try this 1-line macro.
Code:
Sub TTC()
  Range("F2", Range("F" & Rows.Count).End(xlUp)).TextToColumns Destination:=Range("A2"), DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 2), Array(2, 2), Array(5, 2), Array(6, 2), Array(9, 2))
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,941
Members
449,094
Latest member
teemeren

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