Skip to content
xlsoffice. All Rights Reserved
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Lookup and Reference Examples

  • Basic INDEX MATCH approximate in Excel
  • Excel Advanced Lookup using Index and Match Functions
  • Count rows with at least n matching values
  • INDEX function: Description, Usage, Syntax, Examples and Explanation
  • How to get relative column numbers in a range in Excel

Data Analysis Examples

  • How to calculate correlation coefficient Correlation in Excel
  • Example of COUNTIFS with variable table column in Excel
  • Move chart to a separate worksheet in Excel
  • What-If Analysis: Scenarios and Goal Seek in Excel
  • How to Create Area Chart in Excel

Data Validation Examples

  • Excel Data validation date in specific year
  • Excel Data validation no punctuation
  • Excel Data validation must begin with
  • Excel Data validation allow weekday only
  • Excel Data validation exists in list

How to strip protocol and trailing slash from URL in Excel

by

To remove the protocol (i.e. http://, ftp://, etc.) and trailing slash from a URL, you can use a formula based on the MID, FIND, and LEN functions.

Formula

=MID(url,FIND("//",url)+2,LEN(url)-FIND("//",url)-1-(RIGHT(url)="/"))

Explanation

In the example shown, the formula in C5 is:

=MID(B4,FIND("//",B4)+2,LEN(B4)-FIND("//",B4)-1-(RIGHT(B4)="/"))

How this formula works

The core of this formula is the MID function, which extracts the text in a URL starting with the character after “//”, and ending with the character before the trailing slash (“/”):

=MID(url,start,chars)

The url comes straight from B4.

Worked Example:   How to get first word in Excel

The start is calculated using the FIND function like this:

FIND("//",B4)+2

FIND returns the position of the double slash (“//”) in the URL as a number, so we add 2 in order to start extracting at the next character.

Worked Example:   LEN, LENB functions: Description, Usage, Syntax, Examples and Explanation

Chars represents the number of characters to extract. We calculate this using the following expression:

LEN(B4)-FIND("//",B4)-1-(RIGHT(B4)="/")

The LEN function calculates the length of the original URL, from which we subtract the position of “//” minus 1. we also use a bit of Boolean logic to conditionally subtract 1 more character:

(RIGHT(B4)="/")

Here the RIGHT function extracts the last character which is compared to “/”. A result of TRUE is evaluated as 1, while a result of FALSE is evaluated as 0.

Worked Example:   Excel Data validation must contain specific text

The Boolean logic is used to avoid additional conditional logic.

Post navigation

Previous Post:

How to get top level domain (TLD) in Excel

Next Post:

How to remove trailing slash from url in Excel

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others
  • Convert Text to Numbers in Excel
  • How to convert numbers to text using TEXT function in Excel
  • BAHTTEXT function: Description, Usage, Syntax, Examples and Explanation
  • Remove last characters from right in a cell in Excel
  • How to check if cell contains one of many things in Excel
  • Get days between dates in Excel
  • Add decimal minutes to time in Excel
  • How to calculate Next working/business day in Excel
  • Get month from date in Excel
  • How to calculate Quarter of Date in Excel
  • Calculate interest for given period in Excel
  • PMT, RATE, NPER, PV and FV Financial Functions in Excel
  • Tax rate calculation with fixed base in Excel
  • How to calculate simple interest in Excel
  • How to calculate annuity for interest rate in excel
© 2022 xlsoffice . All Right Reserved. | Teal Smiles