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.
Leave a Comment