Split Column on first numeric character

Sayth

Board Regular
Joined
Jun 4, 2010
Messages
212
Is there a way to split a column on the first numeric character?

I have text which has a number in a varied position in the text, however the text after it would be good in another column. Is this possible?

Example in following example both 3 and 4 appear in different positions and with a different number of preceding spaces.

Code:
[TABLE="width: 529"]
<colgroup><col></colgroup><tbody>[TR]
[TD]B G 4 Mossman x Starlevie (Fasliyev(USA))[/TD]
[/TR]
[TR]
[TD]B OR BR F 3 Teofilo(IRE) x Encapsulate (Encosta de Lago)[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi

To find the postion of the first digit in the text you can use:

=MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"))
 
Upvote 0
Hi

To find the postion of the first digit in the text you can use:

=MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"))

PowerQuery did not understand MIN.
Code:
= Table.AddColumn(#"Changed Type38", "Details", each Table.SplitColumn("Main_Race (3)",[#"description - Copy"],Splitter.SplitTextByDelimiter(MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"))),2))
 
Upvote 0
Simple function can help:

Code:
let
    Source = (string as text) => let
        Source = {0,1,2,3,4,5,6,7,8,9},
        #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
        #"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type text}}),
        #"Added Custom" = Table.AddColumn(#"Changed Type", "SearchIn", each string),
        #"Added Custom1" = Table.AddColumn(#"Added Custom", "Result", each Text.PositionOf([SearchIn], [Column1])),
        #"Filtered Rows" = Table.SelectRows(#"Added Custom1", each [Result] >= 0),
        #"Grouped Rows" = Table.Group(#"Filtered Rows", {}, {{"Position", each List.Min([Result]), type number}}),
        Position = #"Grouped Rows"{0}[Position]
    in
        Position
in
    Source
 
Upvote 0
Simple function can help:

Code:
let
    Source = (string as text) => let
        Source = {0,1,2,3,4,5,6,7,8,9},
        #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
        #"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type text}}),
        #"Added Custom" = Table.AddColumn(#"Changed Type", "SearchIn", each string),
        #"Added Custom1" = Table.AddColumn(#"Added Custom", "Result", each Text.PositionOf([SearchIn], [Column1])),
        #"Filtered Rows" = Table.SelectRows(#"Added Custom1", each [Result] >= 0),
        #"Grouped Rows" = Table.Group(#"Filtered Rows", {}, {{"Position", each List.Min([Result]), type number}}),
        Position = #"Grouped Rows"{0}[Position]
    in
        Position
in
    Source

Thanks I am still trying to figure out how to use this as I don't have a parameter and each time I try to create a custom function it asks for a parameter.
 
Upvote 0
You can add this function by creating a new blank query, then go to advanced editor and paste my code -it will not ask for parameters.
 
Upvote 0

Forum statistics

Threads
1,214,561
Messages
6,120,245
Members
448,952
Latest member
kjurney

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