Go Back

How to Remove a Trailing Slash from a URL Link in Excel

We can remove a trailing slash from a URL LINK by using a combination of LEFT, RIGHT, and LEN functions. This will delete the slash from the URL. We will walk through the steps below to understand how this works.

Figure 1: Results of removed slash from URL using the LEFT, RIGHT, and LEN functions

Formula

=LEFT(A4,LEN(A4)-(RIGHT(A4)="/"))

Setting up the Data

  • We will set up our data by inputting 3 URLs in Cell A4 to Cell A6
  • We will name Cell B3 as OUTPUT URL and Cell A3 as INPUT URL

Figure 2: How to Remove a Trailing Slash from a URL Link

Removing a Trailing Slash from a URL Link

  • We will click on Cell B4 and then, formulas on the menu bar

Figure 3: How to Remove a Trailing Slash from a URL Link

  • We will click on Text, scroll down the list and click on LEFT

Figure 4: How to Remove a Trailing Slash from a URL Link

  • We will see the dialog box as shown in figure 4
  • We will input the formula below into the text field

(A4,LEN(A4)-(RIGHT(A4)="/"))

Figure 5: How to Remove a Trailing Slash from a URL Link

  • We will click OK

Figure 6: How to Remove a Trailing Slash from a URL Link

  • We will use the drop-down feature to get the OUTPUT URL of Cell A5 and Cell A6

Figure 7: Results of removed slash from URL using the LEFT, RIGHT, and LEN functions

Note

We can also remove the trailing slash by typing the formula below into Cell B4 and then hit the enter button.

=LEFT(A4,LEN(A4)-(RIGHT(A4)="/"))

Explanation

  • Trailing slash (“/”)

This is the last character that appears in each of the INPUT URL

  • The formula =LEFT(A4,LEN(A4)-(RIGHT(A4)="/"))

This formula is used to extract all values to the left in the specified cell. It, however, removes the last character from the URL PROVIDED IT IS A SLASH. Hence, if a URL doesn’t contain a slash at the end, the output will be the same as the input.

Instant Connection to an Expert through our Excelchat Service

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:
Here are some problems that our users have asked and received explanations on

Hi, can you add trailing slash at the end of all URLs
Solved by B. A. in 29 mins
Need to add trailing slash / to list of urls which don't have them
Solved by C. E. in 30 mins
How do I remove trailing numbers after tenths place in a percentage?
Solved by E. H. in 12 mins

Leave a Comment

avatar