Results 1 to 2 of 2

Power Query - Extract specific data from text and concatenate with delimiter

Threaded View

Riahon Power Query - Extract... 09-03-2020, 11:19 AM
alansidman Re: Power Query - Extract... 09-03-2020, 11:58 AM
  1. #1
    Registered User
    Join Date
    08-22-2020
    Location
    New Zealand
    MS-Off Ver
    Office 365
    Posts
    1

    Power Query - Extract specific data from text and concatenate with delimiter

    Hello, I have use case where I copy paste system rules to analzye into notepad.
    I manually copy the ID's to help me run query's. This works ok for small rules but I want to automate this so I paste the rule into notepad and then refresh power query to automatically
    1. extract the ID's from text string
    2. concatenate the ID's into single text string with ',' delimiter

    So far the best I have gotten is:
    Load text to PQ
    PQ will separate by space
    Transpose to single column
    filter ID's
    add column with delimiter
    transpose to single row and merge
    output to excel as single text string with delimiter
    however....

    If I update the file with a new string it fails.

    The reason message is that the number of columns have changed because the number of ID's extracted will be different each time. I can see that why that fails but now I can't work out a more efficient method.

    Here is a mock up of file I use. ID is usually " 1-89GBH52 (Length can be from 8 - 10)

    (PromotionID = 1-AFLLL34 or PromotionID = 1-5HGOAPAD or PromotionID = 1-DD98ADL or PromotionID = 1-1KLJH8O) sets procedural condition variable to true

    What I am trying to achieve is that at any time I can just add new data to the text file (deleting old first) and refresh power query excel doc and it will output the string like this:
    ('1-AFLLL34','1-5HGOAPAD','1-DD98ADL','1-1KLJH8O')

    I can then paste that into SQL query.

    Cheers
    Sam
    Last edited by Riahon; 09-03-2020 at 11:42 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Extract specific rows based on criteria in power query
    By ronakchoudhary in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-31-2020, 05:02 PM
  2. [SOLVED] Extract Data with Power Query and Groupby tool
    By GerryZucca in forum Excel General
    Replies: 7
    Last Post: 06-28-2020, 11:10 AM
  3. Replies: 13
    Last Post: 05-17-2020, 05:33 AM
  4. How to concatenate cell reference and text in Power Query?
    By basispoints in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-06-2019, 11:22 AM
  5. power query or macro - extract data from scholaro (website)
    By stefano78 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-03-2018, 05:34 AM
  6. [SOLVED] Power Query to Extract Data based on multiple criteria
    By Philipsfn in forum Excel Formulas & Functions
    Replies: 27
    Last Post: 01-16-2018, 01:45 PM
  7. [SOLVED] Power Query: Extract data from table after other rows are filtered
    By JimDandy in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-25-2017, 02:10 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1