Forum Discussion

Moniek's avatar
Moniek
Icon for Resolver I rankResolver I
2 years ago
Solved

Extra column with data which contains in a other column

Hi 

I have got a table (see screenshot) and I have column Nr and Description and I want to generate the column Result. Is that possible? The results are different based on the positions.

 

  • Good day Moniek,

    If the rule is "extract 'P's and digits", this code will extract "Result" from "Description".

    = Table.AddColumn(#"Previous Step", "Result", each Text.Select([Description], {"P","0".."9"}), type text)

    However, the rule may be stronger than this and may, for example, require digits to be included only if they follow Ps. The finite list of examples aren't enough to deduce it. Nevertheless I hope this helps a bit.

1 Reply

  • collinsg's avatar
    collinsg
    Icon for Solution Sage rankSolution Sage

    Good day Moniek,

    If the rule is "extract 'P's and digits", this code will extract "Result" from "Description".

    = Table.AddColumn(#"Previous Step", "Result", each Text.Select([Description], {"P","0".."9"}), type text)

    However, the rule may be stronger than this and may, for example, require digits to be included only if they follow Ps. The finite list of examples aren't enough to deduce it. Nevertheless I hope this helps a bit.