Trim from end by delimiter ">"

JosephGourvenec

New Member
Joined
Oct 23, 2015
Messages
12
Hi All,

I need some help to acheive triming from the end by the first ">" delimiter from the end in a structure for example:



Root > Technology > Photography > Lenses
Root > Gifts > Flowers
Root > Sports > Clubs > Running
Root > Insurance > Car


What I would like to acheive is having a formula that simply takes the last characters off e.g. " > Lenses " so the final result is just "Root > Technology > Photography"

Example with formula from above:


Root > Technology > Photography
Root > Gifts
Root > Sports > Clubs
Root > Insurance



Thanks in advance everyone fro being #awesome
 
Last edited:

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
i think this works

Code:
=LEFT(A2,FIND("#",SUBSTITUTE(A2,"\","#",LEN(A2)-LEN(SUBSTITUTE(A2,"\",""))))-0)
 
Upvote 0
Hello,
You can use this nifty formulae which peterSSs posted in a similar thread question

=LEFT(A1,FIND(">>",SUBSTITUTE(A1,">",">>",LEN(A1)-LEN(SUBSTITUTE(A1,">",""))))-1)
 
Upvote 0
Here's another way:
Sheet1

*AB
1Root > Technology > Photography > LensesRoot > Technology > Photography
2Root > Gifts > FlowersRoot > Gifts
3Root > Sports > Clubs > RunningRoot > Sports > Clubs

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:274px;"><col style="width:217px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
B1=TRIM(MID(SUBSTITUTE(A1," ",REPT(" *",100)),1,(LEN(A1)-LEN(SUBSTITUTE(A1,">","")))*300))

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
EDIT: The REPT should have a single space between the quote marks (no asterisk).
 
Last edited:
Upvote 0
Hi,
Just curious as which formulas worked as after test all of the posts I could any get Petersss nifty formula to work??
 
Upvote 0
Assuming your individual text strings are less than 300 characters long and the delimiter is consistently a greater than symbol surrounded by single spaces, then this formula should work as well...

=SUBSTITUTE(A1," > "&TRIM(RIGHT(SUBSTITUTE(A1,">",REPT(" ",300)),300)),"")
 
Upvote 0
.. this formula should work as well...

=SUBSTITUTE(A1," > "&TRIM(RIGHT(SUBSTITUTE(A1,">",REPT(" ",300)),300)),"")
:eek: High risk!

eg "Root > Insurance > Caravans & Cars > Car" --> "Root > Insuranceavans & Cars"
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,444
Messages
6,124,893
Members
449,194
Latest member
JayEggleton

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top