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

Lookup and Reference Examples

  • Count rows with at least n matching values
  • How to retrieve first match between two ranges in Excel
  • Complete List of Excel Lookup and Reference Functions, References and Examples
  • Find closest match in Excel
  • Vlookup Examples in Excel

Data Analysis Examples

  • How To Filter Data in Excel
  • Understanding Pivot Tables in Excel
  • How to calculate average last N values in a table in Excel
  • Chart Axes in Excel
  • How To Perform and Interpret Regression Analysis in Excel

Data Validation Examples

  • Excel Data validation with conditional list
  • Excel Data validation must not contain
  • Excel Data validation must contain specific text
  • Data validation must not exist in list
  • Excel Data validation no punctuation

How to remove trailing slash from url in Excel

by

To remove a trailing slash from a URL or path, you can use a formula based on the LEFT and LEN functions.

Formula

=LEFT(url,LEN(B4)-(RIGHT(url)="/"))

Explanation

In the example shown, the formula in cell C6 is:

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

How this formula works

At the core, this formula uses the LEFT function to return text starting from the left. To work out how many characters should be returned, the formula uses this expression:

LEN(B4)-(RIGHT(B4)="/")

Here, total characters are calculated with the LEN function. From this number, the result of the following expression is subtracted:

RIGHT(B4)="/"

With number of characters not specified, RIGHT will return the last character in the string. If this characters is a forward slash “/”, the expression returns TRUE. If not, it returns FALSE.

Worked Example:   LEFT, LEFTB functions: Description, Usage, Syntax, Examples and Explanation

Because TRUE and FALSE are coerced automatically to 1 and zero in math operations, we  subtract zero from the result of LEN when the last characters is not “/” and we subtract 1 when the last characters is “/”.

Worked Example:   How to create email address with name and domain in Excel

The result is provided to LEFT, which returns the final result.

Worked Example:   Convert date string to date time in Excel

Post navigation

Previous Post:

How to strip protocol and trailing slash from URL in Excel

Next Post:

How to get full workbook name and path 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
  • Remove last characters from right in a cell in Excel
  • How to translate letters to numbers in Excel
  • How to strip html from text or numbers in Excel
  • Split numbers from units of measure in Excel
  • Split dimensions into two parts in Excel Worksheet
  • How to get same date next month or previous month in Excel
  • Calculate time difference in hours as decimal value in Excel
  • YEAR function: Description, Usage, Syntax, Examples and Explanation
  • How to get Holiday Date from Year in Excel
  • Create date range from two dates in Excel
  • COUPNUM function: Description, Usage, Syntax, Examples and Explanation
  • YIELD function: Description, Usage, Syntax, Examples and Explanation
  • CUMPRINC function: Description, Usage, Syntax, Examples and Explanation
  • RECEIVED function: Description, Usage, Syntax, Examples and Explanation
  • How to calculate principal for given period in Excel
Acronyms, Abbreviations, Initialism & What They Stand For
© 2022 xlsoffice . All Right Reserved. | Teal Smiles