Forum Discussion
JohnHarker
2 years agoNew Member
Extracting a sequence in Power Query
I have a long column of data where I need to extract a specific sequence. I am looking for the format ####-##A####. The problem is there is no pattern as to where this sequence apprears in the cell a...
wdx223_Daniel
Community Champion
2 years agoNewStep=Table.AddColumn(YourTable,"Extract",each List.RemoveNulls(List.Transform({0..Text.Length([LongTextColumn])-12},(x)=>let a=Text.Range([LongTextColumn],x,11),b=Text.SplitAny(a,{"-","A".."Z"}) in if List.Count(b)<>3 then null else if List.AllTrue(List.Transform({0..2},(y)=>Text.Remove(b{y},{"0".."9"})="" and Text.Length(b{y})={4,2,4}{y}) then a else null){0}?)