+ Reply to Thread
Results 1 to 2 of 2

Removing text based on a character in a cell

  1. #1
    Registered User
    Join Date
    04-29-2013
    Location
    Minneapolis, MN
    MS-Off Ver
    Excel 2010
    Posts
    1

    Removing text based on a character in a cell

    I have a string of text that I would like to keep everything to the left of the furthest right "-". See the example below. I have tried many variations of formulas including LEFT, RIGHT, LEN, SEARCH, FIND, but have been unable to find the right formula. The example below is what I am looking to apply a formula to.

    Men's Long Sleeve Oxford-WHT-3XL
    Men's Blue Manager Polo-BLU-3XL
    ACME Polo Shirt-WHT-SM
    ACME Long Sleeve Polo Shirt-WHT-SM


    The result I need to be able to get:

    Men's Long Sleeve Oxford-WHT
    Men's Blue Manager Polo-BLU
    ACME Polo Shirt-WHT
    ACME Long Sleeve Polo Shirt-WHT

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Removing text based on a character in a cell

    hi Nate L, welcome to the forum. if it always just have 2 dashes, then:
    =LEFT(A1,FIND("-",A1,FIND("-",A1)+1)-1)

    if it can be more, then:
    =LEFT(A1,FIND("-",A1,FIND("^",SUBSTITUTE(A1,"-","^",LEN(A1)-LEN(SUBSTITUTE(A1,"-","")))))-1)

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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