+ Reply to Thread
Results 1 to 8 of 8

Need to extract only words between two dashes in other cell

  1. #1
    Registered User
    Join Date
    10-15-2014
    Location
    india
    MS-Off Ver
    MS office 2013
    Posts
    6

    Post Need to extract only words between two dashes in other cell

    hi,
    i've a data sheet which contains value like below,

    sk-1245
    brd-47890
    1415-bk-1246
    1415-sk-125
    1415-brd-2126

    now i need only word between two dashes. as we can see characters btween two dashes are either 2 or 3..


    so how can i get the result in another cell?


    please help.

    thank you,

  2. #2
    Forum Expert
    Join Date
    03-28-2014
    Location
    Hyderabad,India
    MS-Off Ver
    Excel 2013
    Posts
    1,887

    Re: Need to extract only words between two dashes in other cell

    =MID(A1,FIND("-",A1)+1,LEN(A1)-FIND("-",A1,FIND("-",A1)+1)-1)
    assuming that data is in cell a1 just drag it down the column
    a basic function can be done more effective with substitute function also a
    Punnam

  3. #3
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Need to extract only words between two dashes in other cell

    There are different ways to achieve this... One of them is this.....

    Assuming your string is in A1, then
    In B1
    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Need to extract only words between two dashes in other cell

    sk-1245
    brd-47890
    for the above what is the answer
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  5. #5
    Forum Contributor
    Join Date
    01-21-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    227

    Re: Need to extract only words between two dashes in other cell

    Quote Originally Posted by Punnam View Post
    =MID(A1,FIND("-",A1)+1,LEN(A1)-FIND("-",A1,FIND("-",A1)+1)-1)
    assuming that data is in cell a1 just drag it down the column
    a basic function can be done more effective with substitute function also a
    Punnam
    it is giving

    bk-
    sk
    brd

    seems it needs tweaking...
    If I've been of help, plz add reputation.

  6. #6
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Need to extract only words between two dashes in other cell

    =IFERROR(MID(A1,SEARCH("-*-",A1)+1,SEARCH("-",SUBSTITUTE(A1,"-","^",1))-SEARCH("-*-",A1)-1),"")
    try this

  7. #7
    Forum Expert
    Join Date
    03-28-2014
    Location
    Hyderabad,India
    MS-Off Ver
    Excel 2013
    Posts
    1,887

    Re: Need to extract only words between two dashes in other cell

    @ sakmsb,

    Yes it is happening i have modified a bit ( thank for spotting it)
    =MID(A1,FIND("-",A1)+1,FIND("-",A1,FIND("-",A1)+1)-FIND("-",A1)-1)
    and it working fine i think

    Punnam

  8. #8
    Forum Contributor
    Join Date
    01-21-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    227

    Re: Need to extract only words between two dashes in other cell

    Quote Originally Posted by Punnam View Post
    @ sakmsb,

    Yes it is happening i have modified a bit ( thank for spotting it)
    =MID(A1,FIND("-",A1)+1,FIND("-",A1,FIND("-",A1)+1)-FIND("-",A1)-1)
    and it working fine i think

    Punnam
    Yes, it is fine now.

    So for OP i have just added Iferror part.

    @OP, use this:- =IFERROR(MID(A1,FIND("-",A1)+1,FIND("-",A1,FIND("-",A1)+1)-FIND("-",A1)-1),"")

+ 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. how to add dashes between words in a cell
    By beesonic in forum Excel General
    Replies: 7
    Last Post: 11-14-2018, 08:25 AM
  2. [SOLVED] How to extract strings before and after (-) dashes --- macro
    By missy22 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-11-2014, 12:31 PM
  3. Replies: 7
    Last Post: 02-25-2014, 02:00 AM
  4. Replies: 3
    Last Post: 01-17-2014, 08:08 PM
  5. Replies: 5
    Last Post: 08-13-2012, 05:49 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