WEB DEVELOPMENT, DESIGN & MARKETING SOLUTIONS
Nick Wakelin, London, UK

Nick Wakelin's Blog

Excel Tips and Tricks

May 16th, 2012 by Nick Wakelin

Here are a few useful tricks I picked up whilst working with Excel

How to get the filename (or last part) from a URL in Excel

We have a URL http://www.nickwakelin.co.uk/pagewewant.html and we want to extract everything after the last forward slash.

  1. Copy the URL into Cell A1
  2. Copy the following formula into Cell A2
=MID(A1,FIND("*",SUBSTITUTE(A1,"/","*",LEN(A1)-LEN(SUBSTITUTE(A1,"/",""))))+1,LEN(A1))

You will now see “pagewewant.html” in cell A2

Please note: this will only work if you don’t have a trailing slash at the end of the URL

How to remove the trailing slash from a url in Excel

We have a URL http://www.nickwakelin.co.uk/pagewewant/ and we want to extract the forward slash at the end of it

  1. Copy the URL into Cell A1
  2. Copy the following formula into Cell A2
=LEFT(A1,LEN(A1)-1)

You will now see “http://www.nickwakelin.co.uk/pagewewant” in cell A2


Tags: ,