简体   繁体   中英

Formula to edit part of a text in one cell based on an values in another cell

I'm looking for an excel based formula for one of my projects which can help in removing certain parts of a cell (Cell A - names separated by a based on the values in Cell B (similar format as Cell A). I'm running a flow on this file as well hence cannot run VBA based solutions as my connector is excel online.

Example

Cell A - cat;dog;rat;rabbit

Cell B - rabbit;dog

Result needs to be - cat;rat

For O365 Beta Channel:

=TEXTJOIN(";",,UNIQUE(TEXTSPLIT(A1&";"&B1,,";"),,1))

All O365 users (though works only in the desktop version, not online):

=TEXTJOIN(";",,UNIQUE(FILTERXML("<a><b>"&SUBSTITUTE(A1&";"&B1,";","</b><b>")&"</b></a>","//b"),,1))

For Excel Online:

=TEXTJOIN(";",,UNIQUE(TRIM(MID(SUBSTITUTE(A1&";"&B1,";",REPT(" ",99)),99*SEQUENCE(1+LEN(A1&";"&B1)-LEN(SUBSTITUTE(A1&";"&B1,";","")),,0)+1,99)),,1))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM