The url comes straight from B5. The start is calculated using the FIND function like this: 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. Chars represents the number of characters to extract. We calculate this using the following expression: 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: 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. The Boolean logic is used to avoid additional conditional logic.

Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.