Nikola Nastevski
Nikola Nastevski

Reputation: 937

Remove everything after certain string in Excel 2010

I have this string:

Category1 > SubCategory11 > SubSubCategory111 > Something

Category2 > SubCategory21 > SomethingElse

Category3 > SubCategory31 > SubSubCategory32 > SubSubSubCategory33 > AnotherSomethingElse

Category4 > Else

How can I remove everything that is after the last ">" ?

Thanks in advance.

Upvotes: 0

Views: 7278

Answers (1)

Jerry Beaucaire
Jerry Beaucaire

Reputation: 3197

A formula approach:

=LEFT(A1, FIND("|", SUBSTITUTE(A1, ">", "|", LEN(A1)-LEN(SUBSTITUTE(A1, ">", "")))))

TO get rid of the > too:

=TRIM(LEFT(A1, FIND("|", SUBSTITUTE(A1, ">", "|", LEN(A1)-LEN(SUBSTITUTE(A1, ">", ""))))-1))

Upvotes: 2

Related Questions