+ Reply to Thread
Results 1 to 16 of 16

Split Dash "-" within values

Hybrid View

bjnockle Split Dash "-" within... 08-21-2015, 09:54 PM
FDibbins Re: Split Dash "-" within... 08-21-2015, 10:21 PM
bjnockle Re: Split Dash "-" within... 08-21-2015, 10:26 PM
FDibbins Re: Split Dash "-" within... 08-21-2015, 10:29 PM
bjnockle Re: Split Dash "-" within... 08-21-2015, 10:40 PM
FDibbins Re: Split Dash "-" within... 08-22-2015, 09:49 AM
Tony Valko Re: Split Dash "-" within... 08-22-2015, 09:54 AM
skywriter Re: Split Dash "-" within... 08-21-2015, 10:41 PM
FDibbins Re: Split Dash "-" within... 08-21-2015, 10:48 PM
FDibbins Re: Split Dash "-" within... 08-21-2015, 10:47 PM
Tony Valko Re: Split Dash "-" within... 08-22-2015, 09:37 AM
FDibbins Re: Split Dash "-" within... 08-22-2015, 09:58 AM
Tony Valko Re: Split Dash "-" within... 08-22-2015, 10:00 AM
Tony Valko Re: Split Dash "-" within... 08-22-2015, 10:12 AM
FDibbins Re: Split Dash "-" within... 08-22-2015, 10:20 AM
Tony Valko Re: Split Dash "-" within... 08-22-2015, 10:26 AM
  1. #1
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,012

    Split Dash "-" within values

    Trying to split only dash ("-") within text values in column A (A2:A7) into column B. See sample data.

    Month	Spilt dash here
    Jan - sales is bad	-
    Febuary - what is happening?	-
    March - rainy	-
    April-ok	-
    May-where is the water	-
    June - yes!123	-
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: Split Dash "-" within values

    You could probably use Text2Columns?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,012

    Re: Split Dash "-" within values

    looking for a formula to split it out as the data set is huge.

    Thanks

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: Split Dash "-" within values

    T2C would do it quicker than a formula, but try these...
    for the 1st part...
    =LEFT(A2,FIND("-",A2,1)-2)
    for the 2nd part...
    =RIGHT(A2,LEN(A2)-FIND("-",A2,1)-1)

  5. #5
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,012

    Re: Split Dash "-" within values

    FDibbins: only need the dashes to be extracted from the values and not the values. for example, Jan - sales is bad, formula should only extract the - from the cell.

    Thanks

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: Split Dash "-" within values

    @ Tony, perhaps the OP only wants the dashes?

    Quote Originally Posted by bjnockle View Post
    FDibbins: only need the dashes to be extracted from the values and not the values. for example, Jan - sales is bad, formula should only extract the - from the cell.

    Thanks

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Split Dash "-" within values

    Quote Originally Posted by FDibbins View Post
    @ Tony, perhaps the OP only wants the dashes?
    Ok, maybe this...

    Entered in B2 and copied down:

    =IF(COUNT(FIND("-",A2)),"-","")
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  8. #8
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: Split Dash "-" within values

    looking for a formula to split it out as the data set is huge.
    Select cell A2 then Control + Shift + Down Arrow
    This will select all your data instantly, even if it goes to the last cell in the worksheet.
    Data tab - Text to columns, choose delimited, choose next, choose other, type - into the box, finish. It's faster than I could write either one of those formulas.

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: Split Dash "-" within values

    Quote Originally Posted by skywriter View Post
    Select cell A2 then Control + Shift + Down Arrow
    This will select all your data instantly, even if it goes to the last cell in the worksheet.
    Data tab - Text to columns, choose delimited, choose next, choose other, type - into the box, finish. It's faster than I could write either one of those formulas.
    My thoughts too, but that will give you extra columns with text in them

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: Split Dash "-" within values

    ok, then try this...
    =IF(ISNUMBER(FIND("-",A2,1)),"-","")

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Split Dash "-" within values

    I downloaded the sample file but I can't figure out what you're wanting to do with it.

    Here's the data in the file:

    Data Range
    A
    B
    1
    Month
    Spilt dash here
    2
    Jan - sales is bad
    -
    3
    Febuary - what is happening?
    -
    4
    March - rainy
    -
    5
    April-ok
    -
    6
    May-where is the water
    -
    7
    June - yes!123
    -


    What are you wanting to do? What does "split dash here" mean?

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: Split Dash "-" within values

    Kinda like my post #7

    At the risk of hijacking this thread, do you know if there would be any efficiency difference between "ISNUMBER(FIND" and "COUNT(FIND(" ?

  13. #13
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Split Dash "-" within values

    Let me do some quick testing...

  14. #14
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Split Dash "-" within values

    Looks like ISNUMBER is slightly faster on large ranges:

    Formula1 = ISNUMBER
    Formula2 = COUNT

    Data Range
    A
    B
    C
    D
    E
    F
    G
    2
    Formula1
    3
    4
    Rows
    Test1
    Test2
    Test3
    Test4
    Test5
    Average
    5
    100
    0.00156
    0.00156
    0.00158
    0.00155
    0.00156
    0.001562
    6
    1000
    0.00235
    0.00237
    0.00238
    0.00115
    0.00239
    0.002128
    7
    8
    9
    Formula2
    10
    11
    100
    0.00153
    0.00154
    0.00157
    0.00156
    0.00155
    0.00155
    12
    1000
    0.00244
    0.00264
    0.0026
    0.00127
    0.00265
    0.00232

  15. #15
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: Split Dash "-" within values

    cool, thanks for that

  16. #16
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Split Dash "-" within values

    ____

+ 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: 03-11-2015, 10:05 AM
  2. regex: include split "0=" like "a=" into .pattern
    By DavidRoger in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-02-2014, 01:32 AM
  3. [SOLVED] Formula needed to display "Pass" or "Fail" if a column contains any values other than "yes
    By andreindy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-26-2013, 05:49 PM
  4. Replies: 0
    Last Post: 01-09-2013, 06:52 PM
  5. Split cell values based on "," and "-" and format as shown below
    By Roop in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-22-2012, 12:28 AM
  6. Replies: 3
    Last Post: 02-16-2011, 02:55 PM
  7. [SOLVED] How do I split "A1B2" into "A1" and "B2" using text to column fun.
    By Jennifer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2005, 06:06 PM

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