+ Reply to Thread
Results 1 to 3 of 3

Power Query: Count string of words in a cell.

  1. #1
    Registered User
    Join Date
    11-15-2012
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    41

    Power Query: Count string of words in a cell.

    I'm looking to write a power query function for counting the number of times the string "auto auction" is found within a specific cell. Can someone help me out with this? I can write it in excel, but I'd like to be able to write it in PQ for the obvious reasons.

    Cheers and thanks,

    Brian

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Power Query: Count string of words in a cell.

    I'd recommend uploading sample workbook.

    Without it, it is a bit of guess works as to what your data may look like.

    General concept:
    Assuming that you want to match "auto auction" exactly (i.e. case sensitive).
    1. Replace "auto auction" with blank string.
    Please Login or Register  to view this content.
    2. Subtract length of result from original string length.
    Please Login or Register  to view this content.
    3. Divide Step 2 result with length of "auto auction".

    Combine it all in one and...
    Add custom column.
    Please Login or Register  to view this content.
    0.JPG
    Last edited by CK76; 07-12-2019 at 04:20 PM.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Power Query: Count string of words in a cell.

    Oh, I forgot about another, probably easier method.

    Add custom column: Split string by "auto auction". Count list and subtract 1.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Power Query count rows
    By rs1aj in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-29-2019, 11:45 AM
  2. [SOLVED] Excel Power Query - count formla, same entry shoud listed like A1,A2,A3
    By zeko90 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-31-2019, 02:45 PM
  3. Sub-Forum for Excel Power Tools (Power Query, Power Pivot & Power BI)
    By chullan88 in forum Suggestions for Improvement
    Replies: 10
    Last Post: 06-28-2018, 02:25 PM
  4. New to Power Query Need to refence a cell for SQL query
    By BSWhipp in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-10-2018, 09:00 AM
  5. Replies: 0
    Last Post: 04-05-2018, 01:16 AM
  6. Power Query - merge by part of the string
    By zico8 in forum Excel General
    Replies: 1
    Last Post: 07-31-2017, 04:32 AM
  7. Power Query from CSV - possible to move connection string to excel without MS PQ?
    By jaryszek in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-22-2016, 04:35 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