Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Remove Text in a specific Column

Hi,
Need help, how to remove the Ms, Mr, Ms. Miss in some of the names of this column in Power Query? Thank you

 

  • Hi Anonymous 

     

    Please fo the following

    Please also make sure to use a space behind Ms or Mrs.

     

    Best regards
    Michael
    -----------------------------------------------------
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Appreciate your thumbs up!
    @ me in replies or I'll lose your thread.

     

6 Replies

  • Mikelytics's avatar
    Mikelytics
    Resident Rockstar

    Hi Anonymous 

     

    Please fo the following

    Please also make sure to use a space behind Ms or Mrs.

     

    Best regards
    Michael
    -----------------------------------------------------
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Appreciate your thumbs up!
    @ me in replies or I'll lose your thread.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you so much for the help.

      • Mikelytics's avatar
        Mikelytics
        Resident Rockstar

        Anonymous  Awesome! Thank you for your feedback! 🙂

  • Mikelytics's avatar
    Mikelytics
    Resident Rockstar

    Hi Anonymous 

     

    I also built a more lean solution. with an Added Column.

    if Text.StartsWith([Column1],"Mr ") or Text.StartsWith([Column1],"Mrs ") or Text.StartsWith([Column1],"Ms ") then Text.AfterDelimiter([Column1], " ") else [Column1]

     

    Best regards
    Michael
    -----------------------------------------------------
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Appreciate your thumbs up!
    @ me in replies or I'll lose your thread.

     

    • VinceLuna's avatar
      VinceLuna
      Frequent Visitor

      Mike,

      Thanks for this solution.  Is there a way to add a search in a table with common prefixs? I'd rather automate the replacements based upon the everchange master data set.   I have a dataset that includes DR, dr DRS. Mrs, Miss, Ms, MS, Deacon, Dcn and other combinations. I can compile a list form the data using splitter to find the most prevelant prefixes. The list looks like: 

       

      Name.1              Count   Title Made

      Sister12Sr.
      Sr137Sr.
      Sr.32Sr.
      Ms35Ms.
      Ms.23Ms.
      Mrs141Mrs.
      Mrs.97Mrs.
      Mr15Mr.
      Mr.12Mr.
      Miss12Miss
      Rev8Father
      Dr12Dr.
      Dr.15Dr.
      Deacon3Deacon
       5B
      Alexandra5B
      Alexandria3B