简体   繁体   中英

Split excel string into two columns

I have column of text in Excel. Some text may include a special tag:

<RL>

So you may have this:

Some text <RL> some more text

Or text without this special tag

Some plain text

What I would like is a function that can split this text into two separate columns (B & C). At the point of the tag. In instances where there is no tag I'd like to copy the entire string into column B The tag should not be displayed in either col B or col C

Any ideas?

Cell B1:

=IFERROR(LEFT(A1,FIND("<RL>",A1,1)-1),A1)

Cell C1

=IFERROR(RIGHT(A1,LEN(A1)-FIND("<RL>",A1,1)-3),"")

Drag down...

In B1 enter:

=IF(ISERROR(FIND("<RL>",A1)),A1,LEFT(A1,FIND("<RL>",A1)-1))

and in C1 enter:

=IF(ISERROR(FIND("<RL>",A1)),"",MID(A1,FIND("<RL>",A1)+4,9999))

and copy these downward:

在此处输入图片说明

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