+ Reply to Thread
Results 1 to 12 of 12

Remove FINAL backslash in URL Column

  1. #1
    Registered User
    Join Date
    06-29-2020
    Location
    Harriman, NY
    MS-Off Ver
    Excel 365 Desktop
    Posts
    22

    Remove FINAL backslash in URL Column

    Hello,

    I need to remove the final backslash on some URLs I have on a list. Not every cell in the column has a backslash at the end of the cell.

    What is the best formula for me to use?

    I have attached a worksheet as an example. Please note: The URLs I am using as examples are from the public website, IMDB.

    Thank you in advance, for your help.

    Best,
    Carol
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Remove FINAL backslash in URL Column

    This might work if all URLs follow the same pattern:

    =IFNA(TEXTBEFORE(A2,"/",8),A2)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Remove FINAL backslash in URL Column

    Another option is you have a variable number of /
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    04-13-2022
    Location
    Kristianstad, Sweden
    MS-Off Ver
    2007/2016
    Posts
    21

    Re: Remove FINAL backslash in URL Column

    Try this
    The old fashion way:
    =IF(RIGHT(A2)="/",LEFT(A2,LEN(A2)-1),A2)

    Drag down

    /LGS
    Last edited by LARS GULYAS; 03-13-2024 at 10:28 PM.

  5. #5
    Banned User!
    Join Date
    03-11-2024
    Location
    usa
    MS-Off Ver
    CURRENT
    Posts
    23

    Re: Remove FINAL backslash in URL Column

    Hey, Carol
    To remove the final backslash from URLs in Excel, you can use the following formula:
    =IF(RIGHT(A1,1)="/",LEFT(A1,LEN(A1)-1),A1)
    Here's how it works:

    RIGHT(A1,1) extracts the last character from the cell A1 (which should be the backslash).
    IF(RIGHT(A1,1)="/",...) checks if the last character is a backslash.
    If the last character is a backslash, LEFT(A1,LEN(A1)-1) removes the last character from the cell A1.
    If the last character is not a backslash, it returns the original cell value A1.
    You can apply this formula to your entire column of URLs. Drag down the formula or double-click the fill handle (the small square at the bottom right corner of the cell with the formula) to fill it down to apply to all cells in the column.

    Here's how you can apply it to your worksheet:

    Insert a new column next to your list of URLs.
    Enter the formula =IF(RIGHT(A2,1)="/",LEFT(A2,LEN(A2)-1),A2) into the first cell of the new column (assuming your URLs are in column A starting from cell A2).
    Press Enter to apply the formula.
    Drag down the formula to apply it to all cells in the column.
    You'll now have your URLs without the final backslash in the new column. You can then copy and paste them back to replace the original URLs if needed.
    This formula will effectively remove the final backslash from URLs in your list.

  6. #6
    Registered User
    Join Date
    06-04-2018
    Location
    Europe
    MS-Off Ver
    Office365
    Posts
    78

    Re: Remove FINAL backslash in URL Column

    Try also:

    =LEFT(A2,LEN(A2)-1)

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Remove FINAL backslash in URL Column

    That will take the last character away even if it isn't a backslash - look at the sample in post #1.

  8. #8
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Remove FINAL backslash in URL Column

    One for luck

    =LEFT(A2,LEN(A2)-IF(RIGHT(A2,1)="/",1,0))

    or since urls don't contain spaces
    =SUBSTITUTE(TRIM(SUBSTITUTE(A2,"/"," "))," ","/")
    Last edited by ByteMarks; 03-14-2024 at 05:46 AM.

  9. #9
    Registered User
    Join Date
    06-29-2020
    Location
    Harriman, NY
    MS-Off Ver
    Excel 365 Desktop
    Posts
    22

    Re: Remove FINAL backslash in URL Column

    Thank you, All, for your help!!!

    ByteMarks, Your formula works
    Tommy90 - the second formula (since there are no spaces) worked
    CarissaKirby, Your formula works as well. Thanks for the explanation too!

    I hope everyone has a nice day!

    Carol

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Remove FINAL backslash in URL Column

    My formula works, too!

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, remember that you can reward anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,056

    Re: Remove FINAL backslash in URL Column

    You can also do them all at once, using this:

    =LET(A,A2:A20,REPLACE(A,LEN(A)+(RIGHT(A)<>"/"),1,""))

    Just delete ALL expected results first! Adjust the bit in red to suit.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  12. #12
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Remove FINAL backslash in URL Column

    Glad to help & thanks for the feedback.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 12-12-2023, 12:40 AM
  2. [SOLVED] Remove Line Breaks from Final Result Issue (CONCATENATE only if value is true)
    By bassinator in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-13-2019, 05:01 PM
  3. Creating a Final Estimate Form and a Final Materials List based on Worksheet Results
    By Crunched For Time in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 12-20-2013, 09:58 PM
  4. [SOLVED] Script to remove final carriage return from Excel csv export
    By Jay1357 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-08-2013, 01:07 PM
  5. replacing lowest test grade with final if final is higher formula help
    By colbyclay in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-16-2012, 02:48 AM
  6. Concatenate to Clipboard-Remove final delimiter
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 01-25-2011, 06:22 PM
  7. Extra Backslash
    By CobraLAD in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2009, 04:47 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1