I have a free form column that includes numbers and characters. My goal is to be able to extract each number into its own column. Calculated Columns or M code is fine. Here is an example:
Segment Notes
1 WO# 1234567 Call Tony @ 623-623-6236 30 prior to arrival
2 Replaced 2 Hoses 7654321
3 Opened WO5674321 on 11/20/2019
Ultimately What I need is each number in each observation in its own column like this:
Segment Notes Num1 Num2 Num3
1 WO# 1234567 Call Tony @ 623-623-6236 30 prior to arrival 1234567 623-692-9493 30
2 Replaced 2 Hoses 7654321 2 7654321
3 Opened WO5674321 on 11/20/2019 5674321 11/20/2019
If it is too difficult to extract dates and phone numbers in their entirety I can live with each element going into its own column. Thanks in advance.
There's an 'is value' function we can take advantage of.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("LY0xC8IwFIT/yvFcK/a9tClugku3gAgdQoagGQohCakI/fdGEe6m7+POWmLqaDEHsKhh1BOuPkbcc9pxgRZ1/FdD9Sh1zRWvDF/r+vaRXGdJ2sAtlOgf4QnBnLewYdLjoIR/gmqCKSE1vJh28QXICcwn6Vv4TM59AA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Segment = _t, Notes = _t]),
#"Added Custom" = Table.AddColumn(Source, "Custom", each Text.Combine(List.RemoveNulls(List.Transform(Text.ToList([Notes]),each if Value.Is(Value.FromText(_), type number) or List.Contains({" ", "-", "/"}, _) then _ else null))))
in
#"Added Custom"