Extract Text from End of Line back to Character

bokenrosie

New Member
Joined
Jun 13, 2014
Messages
44
Hello Mr. Excel,

I'm trying to extract everything from a character "\" to end of the line that it's in. My challenge is some of the lines have one "\" character and others have many.

I just need what appears after the last "\" to the end of the line.

Can anyone tell me what function I need to do?
 

Some videos you may like

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

CA_Punit

Well-known Member
Joined
Nov 18, 2019
Messages
884
Office Version
  1. 365
Platform
  1. Windows
Try this

Book1
FGHI
8gaga/afsyaj/atatav/jaja
9
10
11
Sheet5
Cell Formulas
RangeFormula
I8I8=MID(F8,SEARCH("||",SUBSTITUTE(F8,"/","||",LEN(F8)-LEN(SUBSTITUTE(F8,"/",""))))+1,999)
 

bokenrosie

New Member
Joined
Jun 13, 2014
Messages
44
Is Yourstuff supposed to be the column with the string? column A has my list in it. replacing Yourstuff with A2 did not seem to work.
 

bokenrosie

New Member
Joined
Jun 13, 2014
Messages
44

ADVERTISEMENT

Try this

Book1
FGHI
8gaga/afsyaj/atatav/jaja
9
10
11
Sheet5
Cell Formulas
RangeFormula
I8I8=MID(F8,SEARCH("||",SUBSTITUTE(F8,"/","||",LEN(F8)-LEN(SUBSTITUTE(F8,"/",""))))+1,999)
That looks like exactly what I want. I tried replacing F8 with A2 and it did not work.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
52,934
Office Version
  1. 365
Platform
  1. Windows
Another option
=TRIM(RIGHT(SUBSTITUTE(A2,"/",REPT(" ",100)),100))
 

bokenrosie

New Member
Joined
Jun 13, 2014
Messages
44

ADVERTISEMENT

Maybe I did'nt explain well. Please look at the follwoing, on the left column is what I have and on the Filename is the result I'm looking for. I've tried to the two methods suggested and they are not giving me this result. thank for trying.

LocationFilename
c:\users\joe\projects\smith\Excel Examples.jpgExcel Examples.jpg
c:\users\tom\projects\demos\2002\My First File.docMy First File.doc
c:\users\mary\Green Leaves.mpgGreen Leaves.mpg
 

CA_Punit

Well-known Member
Joined
Nov 18, 2019
Messages
884
Office Version
  1. 365
Platform
  1. Windows
=MID(F8,SEARCH("||",SUBSTITUTE(F8,"\","||",LEN(F8)-LEN(SUBSTITUTE(F8,"\",""))))+1,999)

Syntax Error
 

ER_Neha

Board Regular
Joined
Jul 25, 2020
Messages
121
Office Version
  1. 365
Platform
  1. Windows
Hello, I hope this helps
Book2
AB
1c:\users\joe\projects\smith\Excel Examples.jpgExcel Examples.jpg
2c:\users\tom\projects\demos\2002\My First File.docMy First File.doc
3c:\users\mary\Green Leaves.mpgGreen Leaves.mpg
4
Sheet1
Cell Formulas
RangeFormula
B1:B3B1=TRIM(RIGHT(SUBSTITUTE(A1,"\",REPT(" ",LEN(A1))),LEN(A1)))
 

sandy666

Banned - Rules violations
Joined
Oct 24, 2015
Messages
7,499
with Power Query
LocationText After Delimiter
c:\users\joe\projects\smith\Excel Examples.jpgExcel Examples.jpg
c:\users\tom\projects\demos\2002\My First File.docMy First File.doc
c:\users\mary\Green Leaves.mpgGreen Leaves.mpg

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    TAD = Table.AddColumn(Source, "Text After Delimiter", each Text.AfterDelimiter([Location], "\", {0, RelativePosition.FromEnd}), type text)
in
    TAD
 

Watch MrExcel Video

Forum statistics

Threads
1,122,521
Messages
5,596,653
Members
414,083
Latest member
Mrsash

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
Top