+ Reply to Thread
Results 1 to 14 of 14

Multiple Replace of partial texts

  1. #1
    Registered User
    Join Date
    12-18-2019
    Location
    Turin
    MS-Off Ver
    Office 365
    Posts
    7

    Question Multiple Replace of partial texts

    Hello all !!

    I need to replace certain partial texts within certain other texts. Since the list is long, I need a way to do it without using Find and Replace.

    In the attached workbook, Column A is input, Column B is what I want as output. The "key" table is in columns E and F.

    Thanks!
    Attached Files Attached Files

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: Multiple Replace of partial texts

    with Power Query

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,212

    Re: Multiple Replace of partial texts

    or with a formula (delete all expected results first):

    =LET(R,D2:D4,W,E2:E4,BYROW(A2:A10,LAMBDA(x,SUBSTITUTE(x,LOOKUP(1000,SEARCH(R,x),R),LOOKUP(1000,SEARCH(R,x),W)))))
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  4. #4
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,465

    Re: Multiple Replace of partial texts

    With an other formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,212

    Re: Multiple Replace of partial texts

    Having seen Hans'


    a tweak:

    =LET(R,F2:F4,W,G2:G4,BYROW(A2:A11,LAMBDA(x,IFERROR(SUBSTITUTE(x,LOOKUP(1000,SEARCH(R,x),R),LOOKUP(1000,SEARCH(R,x),W)),x))))

  6. #6
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,465

    Re: Multiple Replace of partial texts

    Having seen Glenn's another formula everything in 1 go:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by HansDouwe; 12-06-2022 at 11:13 AM.

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,212

    Re: Multiple Replace of partial texts

    Hmmm. I couldn't get it working with MAP. But then, I don't fully (maybe not even partially..) understand it. Time to try to take it apart.

  8. #8
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,465

    Re: Multiple Replace of partial texts

    @Glenn,

    If you replace in your own formula BYROW by MAP you have a MAP formula working,
    because a BYROW formula on 1 column works the same as MAP.

    You can also replace in my formula MAP by BYROW.

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,212

    Re: Multiple Replace of partial texts

    Ah yes... so it does. But, in some arcane manner (sparrow's entrails... alchemy... transmutation of base metals into gold...) MAP can also work on multicolumn arrays. I think??

  10. #10
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,465

    Re: Multiple Replace of partial texts

    Yes, a MAP works also on multicolumn and returns multicolumn, BYROW on multicolumn returns only 1 column.
    MAP is actually BYCELL
    Last edited by HansDouwe; 12-06-2022 at 11:52 AM.

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,212

    Re: Multiple Replace of partial texts

    Thank you! Most solutions that I've seen, which use MAP, have been applied to single columns... and mostly by you. I hadn't really appreciated the similarity/difference between it & BYROW.

    Now all I have to do is to find a thread that I can apply it to....

  12. #12
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,391

    Re: Multiple Replace of partial texts

    Here one more variant

    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    03-05-2018
    Location
    Tbilisi, Georgia
    MS-Off Ver
    2013, 2016
    Posts
    271

    Re: Multiple Replace of partial texts

    One more PQ option.
    Attached Files Attached Files

  14. #14
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2404
    Posts
    13,410

    Re: Multiple Replace of partial texts

    Can't tell if this works by accident because of the data.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Dave

+ 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] Replace multiple texts at once
    By adribas in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-27-2022, 04:30 AM
  2. [SOLVED] Please help on COUNTIF Partial text, partial text/words also contained in other texts
    By maria.h in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-15-2020, 10:18 PM
  3. Replies: 5
    Last Post: 11-15-2019, 02:17 PM
  4. Replies: 11
    Last Post: 04-09-2019, 09:50 AM
  5. REPLACE function help replace two separate texts Ctrl H
    By Uldis in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-23-2015, 10:51 AM
  6. Replies: 9
    Last Post: 07-02-2015, 01:13 AM
  7. Replies: 3
    Last Post: 03-02-2011, 01:56 PM

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