Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Remove URL and keep file name with extension

I am having this type of urls in multiple excel cells:

https://stock-media-files.co/previews/e-C-10071-z-a/filename.jpg

Of course the address is always different so REPLACE cannot be used

I want to keep only filename.jpg in every cell

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Assuming that my url in at cell A1 tried with this formula:

=TRIM(RIGHT(SUBSTITUTE(LEFT(A1,FIND("|",SUBSTITUTE(A1,".","|",LEN(A1)-LEN(SUBSTITUTE(A1,".",""))))-1),"\",REPT(" ",255)),255))

But throws error. Not working.

I am using Excel LTSC PRO 2021

Any help please?

>Solution :

Office 365: =TEXTAFTER(A1,"/",-1)
Where -1 means first found from the right of the text value.

Older: =TRIM(RIGHT(SUBSTITUTE(A1,"/",REPT(" ",255)),255))

This changes all / into a space character repeated 255 times. Next it returns the last 255 characters of the amended string. This is the characters after the last found / and 255 minus the length of the string after the last /. TRIM removes al leading space characters, which leaves the string only.

enter image description here

Since your local settings have a , for decimal separator, your Excel can’t use , as a delimiter for it’s arguments. Therefor it uses ; (and likely \ for vertical array separator: ={1\2\3})

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading