+ Reply to Thread
Results 1 to 5 of 5

How to get 3 character before and after dash

  1. #1
    Registered User
    Join Date
    12-22-2015
    Location
    SG
    MS-Off Ver
    2010
    Posts
    40

    How to get 3 character before and after dash

    Hi,

    I have these data "SUSAR No. 197-217"

    I need to get result 197 and 217
    which is 3 character before "-" and 3 character after "-". May I know of a formulae?

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,065

    Re: How to get 3 character before and after dash

    Your limited example data implies, there will always be 3 characters before AND after. I suspect not.
    Supply some more example data please.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Registered User
    Join Date
    12-22-2015
    Location
    SG
    MS-Off Ver
    2010
    Posts
    40

    Re: How to get 3 character before and after dash

    Hi yes it is always 3 characters

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: How to get 3 character before and after dash

    I assume that 197 and 217 will be put in two separate cells.
    Enter formula in B1 and drag formula across to C1
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B C
    1 SUSAR No. 197-217 197 217
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,065

    Re: How to get 3 character before and after dash

    Assuming there's only ever one hyphen in the string

    =MID(A1,FIND("-",A1)-3,3)
    and
    =MID(A1,FIND("-",A1)+1,3)

+ 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. Macro for search and replace dash - unicode character not recognised
    By martin.wirenstrand in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-15-2016, 05:06 AM
  2. [SOLVED] Macro to rename cell content based on the starting character until found same character
    By oeyandyprawira in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-19-2015, 09:36 AM
  3. Replies: 4
    Last Post: 08-26-2014, 09:20 AM
  4. [SOLVED] Need to insert character (dash) between part numbers
    By BYizz in forum Excel General
    Replies: 3
    Last Post: 10-04-2012, 02:21 PM
  5. Display Active Character Count + Limit Character Per Cell
    By euronail in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-22-2011, 04:59 AM
  6. importing undelimited text file data, character-by-character
    By The Mos$ in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-26-2005, 07:10 AM
  7. understanding dash dash in a excel formula
    By ldebner in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-31-2005, 10:05 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