简体   繁体   中英

Excel split everything between characters

I have a column with the following data

Komponenten > Finishing Kit > Sättel

Komponenten > Schaltung & Antrieb > Kettenschaltungen > Schaltwerke

Zubehör > Training & Leistung > Heimtrainer & Rollentrainer > Heimtrainer & Rollentrainer Ersatzteile & Zubehör

I want to keep the text before the first > and keep the entry after the last > (I've bolded the examples above)

This is tricky because some examples have 3 > and some have 4 >

Using formulas, you can get the first item this way:

=LEFT(A1, SEARCH(">",A1,1)-1)

and the last item this way:

=RIGHT(A1,LEN(A1)-SEARCH(">",A1,SEARCH(">",A1,1)+1))

where the string you are looking at is in A1.

Credit: Microsoft Support

First Item:

=TRIM(LEFT(SUBSTITUTE(A1,">",REPT(" ",99)),99))

Last Item:

=TRIM(RIGHT(SUBSTITUTE(A1,">",REPT(" ",99)),99))

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