The simplest method is to use a formula based on the LEFT function with help from LEN and RIGHT.

LEFT formula solution

The solution shown in the worksheet shown is based on theLEFT function.

The formula in cell D5 is:

The tricky part of this formula is that it is conditional.

Excel formula: Remove protocol from URL

If a URL ends in a forward slash ("/") it is removed.

If a URL does not end with a forward slash, it is returned unchanged.

This could be accomplished with the IF function inside the formula, as explained later in the article.

Excel LEN function

The result is returned to LEFT as thenum_charsargument, and LEFT then returns all but the last character.

This works great, but we need to remove the last characteronly when it is a forward slash.

If the expression returns FALSE, Excel will convert FALSE to zero.

Excel RIGHT function

grab the best option to use based on your personal preference.

LEN will also count characters in numbers, but number formatting is not included.

For example, =RIGHT(“apple”,3) returns “ple”.

Excel LEFT function

For example, =LEFT(“apple”,3) returns “app”.