Forum Discussion

CJ_96601's avatar
CJ_96601
Helper V
4 years ago
Solved

Extract Data based on requirements

Need help to get the following result based on a given data:

 

 

CodeRequired Result
E1SE1
E2WE2
E3SE3
M2E2
EE.11
EE.22
EE.1111
M11W11

 

Thanks for your help

  • CJ_96601 

    Based on my understanding of the pattern I created a column in Power Query:

    if (Text.Start([Code],1) = "E" and Text.Start([Code],2) <> "EE") then "E"&Text.Select([Code],{"0".."9"}) else Text.Select([Code],{"0".."9"})

     


     

2 Replies

  • CJ_96601 

    Based on my understanding of the pattern I created a column in Power Query:

    if (Text.Start([Code],1) = "E" and Text.Start([Code],2) <> "EE") then "E"&Text.Select([Code],{"0".."9"}) else Text.Select([Code],{"0".."9"})