Results 1 to 2 of 2

Thread: PQ - make new column by extracting a word from a cell that contains a $ sign

  1. #1
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7

    Cool PQ - make new column by extracting a word from a cell that contains a $ sign

    (question from the web)
    How do I extract from my column A a word that contains in it a $ sign.
    For instance the data in column A would look something like

    A1 = 5465 Apples$50 Twenty
    A2 = 5687 Grapes$597 Three

    answer:
    B1 = Apple$50
    B2 = Grapes$597

    Apple$50 and Grapes$597 needs to be extracted to a new column of the same row.
    Source Source Result
    5465 Apples$50 Twenty 5465 Apples$50 Twenty Apples$50
    5687 Grapes$597 Three 5687 Grapes$597 Three Grapes$597

    Code:
    let 
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        Result = Table.AddColumn(Source, "Result", each if Text.Select([Source],"$")="$" then Text.BetweenDelimiters([Source], " ", " ") else null)
    in
        Result
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  2. #2
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    The Original question is for a PQ solution, but just for comparison, here are some extra solutions using Excel Formulas and VBA coding:
    https://excelfox.com/forum/showthrea...ll=1#post15462
    Last edited by TestAccount; 03-23-2021 at 05:04 PM.
    A Folk, A Forum, A Fuhrer ….

Similar Threads

  1. Replies: 7
    Last Post: 08-24-2015, 10:58 PM
  2. Replies: 1
    Last Post: 08-16-2015, 07:07 AM
  3. Replies: 9
    Last Post: 08-20-2013, 04:39 PM
  4. Replies: 2
    Last Post: 05-13-2013, 12:03 AM
  5. Replies: 1
    Last Post: 10-16-2012, 01:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •