A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hi Ashish (it's been a while)
Assuming data in Table1
(EDIT when is this site going to be fixed re. formatting??? Adding picture for clarity)
let
Source = Excel.CurrentWorkbook(){[Name="**Table1**"]}[Content],
ChangedType = Table.TransformColumnTypes(Source,
{{"PRODUCT\_DESCRIPTION", type text}, {"Ashish Expects", type text}}
),
Result = Table.AddColumn(ChangedType, "Result", each
List.First(
List.RemoveNulls(
List.Transform(Text.PositionOf([PRODUCT\_DESCRIPTION], "/", Occurrence.All),
(x)=>
let
TextRange = try Text.Range([PRODUCT\_DESCRIPTION], x-2, 4)
otherwise null,
TryNumber = if TextRange is null then null
else if Text.Length( Text.Trim(TextRange) ) < 4 then null
else try Number.From( Text.Remove(TextRange, "/") )
otherwise null
in
if TryNumber is null then TryNumber else TextRange
)
)
), type text
)
in
Result
Ideally this should be turned into an external function - Any challenge with this let me know
Your updated file with the above query is available here