+ Reply to Thread
Results 1 to 9 of 9

Get X characters after second to last backslash?

  1. #1
    Registered User
    Join Date
    05-26-2011
    Location
    Adeliade, Austrlaia
    MS-Off Ver
    2016 v1806
    Posts
    5

    Get X characters after second to last backslash?

    Need help please, im trying to get the 6 characters that appear after the second to last backslash.

    eg. in

    \orange rule\apples are nice\pears rock\berrys are yum\strawberry

    i need to get 'berrys' (its always 6 characters and always starts after the second to last backslash)

  2. #2
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,449

    Re: Get X characters after second to last backslash?

    berries is after the 4th backslash, that's why that number 400 is there.
    Your explanation and your example do not match.
    Please Login or Register  to view this content.
    Last edited by bsalv; 10-07-2021 at 01:35 AM.
    Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

  3. #3
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Get X characters after second to last backslash?

    I've modify bsalv's formula to

    =LEFT(TRIM(MID(SUBSTITUTE(A1,"\",REPT(" ",100)),(LEN(A1)-LEN(SUBSTITUTE(A1,"\",""))-1)*100,1000)),6)

    Regards.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,216

    Re: Get X characters after second to last backslash?

    Administrative Note

    Members will tailor the solutions they offer to the version of Office (Excel) that you have. Please check that your forum profile is up-to-date in this respect. Thanks.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  5. #5
    Registered User
    Join Date
    05-26-2011
    Location
    Adeliade, Austrlaia
    MS-Off Ver
    2016 v1806
    Posts
    5

    Re: Get X characters after second to last backslash?

    Quote Originally Posted by menem View Post
    I've modify bsalv's formula to

    =LEFT(TRIM(MID(SUBSTITUTE(A1,"\",REPT(" ",100)),(LEN(A1)-LEN(SUBSTITUTE(A1,"\",""))-1)*100,1000)),6)

    Regards.
    Hi, almost there, its just getting the third to last backslash instead of the second to last using my first test.

    The following

    FAB - Fabrication\RP - Report\MDR123 Manufacturer's Data\001352_0_K05\*

    is returning 'MDR123' but need it to return '001352'

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,523

    Re: Get X characters after second to last backslash?

    One way:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    \orange rule\apples are nice\pears rock\berrys are yum\strawberry berrys
    FAB - Fabrication\RP - Report\MDR123 Manufacturer's Data\001352_0_K05\* 001352
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  7. #7
    Registered User
    Join Date
    05-26-2011
    Location
    Adeliade, Austrlaia
    MS-Off Ver
    2016 v1806
    Posts
    5

    Re: Get X characters after second to last backslash?

    That worked perfectly, thanks TMS

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,523

    Re: Get X characters after second to last backslash?

    You're welcome. Thanks for the rep.

  9. #9
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,475

    Re: Get X characters after second to last backslash?

    Here is another formula that will also work...
    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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. [SOLVED] Date formats with backslash
    By Saturn in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-05-2017, 10:48 PM
  2. [SOLVED] Finding cells which contain no backslash
    By ccastell88 in forum Excel General
    Replies: 1
    Last Post: 03-17-2015, 12:34 AM
  3. [SOLVED] Extract the word between last backslash and before the period
    By mishaq in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-14-2014, 03:15 AM
  4. extract text from cell right of backslash
    By dwhite468 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-27-2013, 12:45 AM
  5. Inserting a backslash into a string of text (a path, actually)?
    By smaier69 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-15-2013, 06:06 PM
  6. Extra Backslash
    By CobraLAD in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2009, 04:47 AM
  7. Find a backslash at end of a cell
    By Pirke in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2005, 07:06 AM

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