+ Reply to Thread
Results 1 to 5 of 5

Power query - replace all contents if word appears

  1. #1
    Registered User
    Join Date
    03-16-2017
    Location
    California
    MS-Off Ver
    365
    Posts
    8

    Power query - replace all contents if word appears

    Hi all,

    I'm working on a Power Query to distill our OneDrive-based (multiple-user) tracker to a to-do list. Most of the functionality is "if this cell is blank/null, it needs to be on the to-do list" which works quite well. However there are often times when it's important to note that a task needs to be done in the future (e.g. the "Call Dig-Alert" task can only be done within 21 days of digging, but one might identify that a dig-alert call is needed while going through the initial overview of the project). In this case, we've just been putting notes in the tracker spreadsheet and making the background red, and whoever sees it next should address it. (I've come to find out that Power Query won't be able to pull in background colors as data, which is a shame). If the task is accomplished, we'll input the confirmation code and it should be bypassed in the to-do list. The obvious problem comes into view when one isn't looking at the tracker, but only at the to-do list, and we miss that task because it wasn't addressed by the Power Query.

    So what I need is some way to replace all the text in the cell if a certain word appears ("Need to call dig-alert" becomes NULL). All I've found so far is the ability to replace string-for-string, so my question is, is there a replace-all-if-string functionality? Or do you think there's a better way to go about it?

    Thanks for your help!

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Power query - replace all contents if word appears

    Are you looking to try to find a string within a string and if found do a replace on the entire string?

    For example, you have the string 'Need to call dig-alert"' and you if you find 'Need' replace the entire string with Null?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    03-16-2017
    Location
    California
    MS-Off Ver
    365
    Posts
    8

    Re: Power query - replace all contents if word appears

    Quote Originally Posted by Norie View Post
    Are you looking to try to find a string within a string and if found do a replace on the entire string?

    For example, you have the string 'Need to call dig-alert"' and you if you find 'Need' replace the entire string with Null?
    Exactly that. As I mentioned, I found the Replace Values function but I don't know if it's possible to replace/nullify the whole value.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Power query - replace all contents if word appears

    I thinks it's possible and I did find some examples when I searched on using wildcards in Find/Replace in Power Query.

    They do seem a bit complicated though, and since I'm kind of new to Power Query I'm not sure how they could be adapted/implemented for your own situation.

  5. #5
    Registered User
    Join Date
    03-16-2017
    Location
    California
    MS-Off Ver
    365
    Posts
    8

    Re: Power query - replace all contents if word appears

    I think the inelegant solution I'll use is to create additional conditional columns, where the column formula is
    Please Login or Register  to view this content.
    I used "eed" and "equire" just to get around forcing uppercase or some other strategy

+ 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. error in power query & power pivot
    By Baldev Kumar in forum Excel Charting & Pivots
    Replies: 8
    Last Post: 01-03-2018, 01:34 AM
  2. SQL -> Power Query SQL
    By happydays886 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-14-2017, 11:56 AM
  3. [SOLVED] power query
    By juanda92 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-12-2016, 08:56 AM
  4. [SOLVED] Find word and if number appears below word then copy
    By ScabbyDog in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-14-2016, 11:12 AM
  5. VBA and Power Query
    By Brawnystaff in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 05-16-2015, 05:10 AM

Tags for this Thread

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