# Thread: Split Column on first numeric character Thanks: 0 Likes:  1 Post #5056800 (1)

1. ## Split Column on first numeric character

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:
```B G 4 Mossman x Starlevie (Fasliyev(USA))

B OR BR F 3 Teofilo(IRE) x Encapsulate (Encosta de Lago)

```

2. ## Re: Split Column on first numeric character

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"))

3. ## Re: Split Column on first numeric character

Originally Posted by pgc01
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))`

4. ## Re: Split Column on first numeric character

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}}),
#"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```

5. ## Re: Split Column on first numeric character

Originally Posted by ralliartur
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}}),
#"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.

6. ## Re: Split Column on first numeric character

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.