简体   繁体   中英

Excel - Split by `;` in each cell

I would like to split these texts into cells in excel:

Hello-HOW-are-YOU-DOING-!
This-is-not-my-name-.
Random-People-are-looking-?
No-!

It should basically look like that:

在此处输入图片说明

At the moment I am using this formula, which gives me just the first split:

=LEFT(Export!A2;FIND("-";Export!A2)-1)

Any recommendations how I can do the split automatically for each - ?

I appreciate your replies!

With data in B1; in C1 enter:

=TRIM(MID(SUBSTITUTE($B1,"-",REPT(" ",999)),COLUMNS($A:A)*999-998,999))

and copy across:

在此处输入图片说明

Or you could do this...

=MID($A2,FIND(B2,$A2)+LEN(B2)+1,FIND("-",$A2,FIND(B2,$A2)+LEN(B2)+1)-(FIND(B2,$A2)+LEN(B2)+1))

in cell D onwards since you already have

=LEFT(A2,FIND("-",A2)-1) 

for the first cell

In Excel O365 with spilling this can now be done through:

=TRANSPOSE(FILTERXML("<t><s>"&SUBSTITUTE(B2,"-","</s><s>")&"</s></t>","//s"))

And from Excel 2013 onwards you could have still used FILTERXML but with INDEX and drag to the right:

=INDEX(FILTERXML("<t><s>"&SUBSTITUTE(B2,"-","</s><s>")&"</s></t>","//s"),COLUMN(A1))

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