+ Reply to Thread
Results 1 to 20 of 20

split txt in column

  1. #1
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    split txt in column

    Hello to all,
    how can I split these texts in 2 columns?:

    Acciaio al carbonio 7,85
    Acciaio comune 7,85
    Acciaio inox 304 7,93
    Alpacca 8,65
    Acciaio laminato 7,85
    Acqua 1
    Acqua ossigenata 1,46
    Amianto 2,5
    Antimonio 6,7
    Arenaria 2,3
    Bronzo di alluminio 10% 8,7
    Bronzo di alluminio 3% 7,7
    Diamante 3,55
    Eternit e simili 2
    Ferro 7,85
    Fosforo 1,98
    Grasso lubrificante 0,93
    Leghe leggere a base Al 2,68
    Leghe leggere a base Mg 1,82
    Legna giocchi 0,35
    -----------------------------------------
    colomn A | column B
    Acciaio al carbonio | 7,85
    Acciaio comune |7,85
    Acciaio inox 304 | 7,93
    Acqua | 1
    Acqua ossigenata | 1,46
    Amianto | 2,5
    Antimonio | 6,7

    I hope I explained,
    Thanks in advance.
    max-max

    -----------------------------------------------------------------------------------------------------

    Ciao a tutti,
    Come posso dividere i testi in 2 colonne?:


    spero di essermi spiegato,
    Un grazie anticipato.
    max-max

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

    Re: split txt in column

    Assuming your have data in A1, place the below formula in B2

    Please Login or Register  to view this content.
    Hope it helps.
    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.

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: split txt in column

    b1=LEFT($A1,FIND("^",SUBSTITUTE($A1," ","^",LEN($A1)-LEN(SUBSTITUTE($A1," ",""))))-1)
    c1=--MID($A1,FIND("^",SUBSTITUTE($A1," ","^",LEN($A1)-LEN(SUBSTITUTE($A1," ",""))))+1,255)
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: split txt in column

    Hello sktneer,
    your formula is not quite accurate.
    The text should be in two columns.
    example:

    Acciaio al carbonio 7,85

    column A = Acciaio al carbonio
    column B = 7,85

    ------------------------------------------------------
    Acqua 1

    column A = Acqua
    column B = 1

    max_max

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: split txt in column

    @sktneer

    That solution will result in the numerical split for, for example:

    Acciaio inox 304 7,93

    as:

    304 7,93

    Since your desired split seems to always occur after the final space, try:

    =TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",255)),255))

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  6. #6
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: split txt in column

    Hello to all,
    the exact formula is martindwilson
    Translated into Italian:
    =SINISTRA($A2;TROVA("^";SOSTITUISCI($A2;" ";"^";LUNGHEZZA($A2)-LUNGHEZZA(SOSTITUISCI($A2;" ";""))))-1)
    =--STRINGA.ESTRAI($A2;TROVA("^";SOSTITUISCI($A2;" ";"^";LUNGHEZZA($A2)-LUNGHEZZA(SOSTITUISCI($A2;" ";""))))+1;255)
    I also thank sktneer and XOR LX
    max_max

    ------------------------------------------------------------------------------------------------------------------------

    Ciao a tutti,
    la formula esatta è di martindwilson
    Tradotta in italiano:
    =SINISTRA($A2;TROVA("^";SOSTITUISCI($A2;" ";"^";LUNGHEZZA($A2)-LUNGHEZZA(SOSTITUISCI($A2;" ";""))))-1)
    =--STRINGA.ESTRAI($A2;TROVA("^";SOSTITUISCI($A2;" ";"^";LUNGHEZZA($A2)-LUNGHEZZA(SOSTITUISCI($A2;" ";""))))+1;255)
    Ringrazio anche sktneer e XOR LX
    max_max

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

    Re: split txt in column

    Sorry I mistaken that.
    Last edited by sktneer; 10-19-2013 at 09:12 AM.

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: split txt in column

    "Sorry I mistaken that. In that case
    in cell B1
    =TRIM(LEFT(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"))-1))

    in cell C1
    =TRIM(LEFT(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"))-1))
    ""

    For Acciaio inox 304 7,93 those two give Acciaio inox in both B1 and C1.

    In fact, your two formulae for B1 and C1 are identical (?).

    Regards

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

    Re: split txt in column

    @ XOR LX
    Thanks for pointing it out......

    Actually the correct formula will be........
    B1 = TRIM(LEFT(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"))-1))
    C1 = TRIM(REPLACE(A1,1,LEN(B1),""))

    I hope this time it's ok.

  10. #10
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: split txt in column

    Thanks XOR LX,
    your first formula:
    in cell B1
    = TRIM (LEFT (A1, MIN (FIND ({0,1,2,3,4,5,6,7,8,9}, A1 & "0123456789")) -1))
    and equal to the second?:
    in cell C1
    = TRIM (LEFT (A1, MIN (FIND ({0,1,2,3,4,5,6,7,8,9}, A1 & "0123456789")) -1))
    max_max
    Last edited by max_max; 10-19-2013 at 09:18 AM. Reason: error

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

    Re: split txt in column

    Sorry max_max. It happens sometimes with everyone.
    Corrected the formula. See post #9.

  12. #12
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: split txt in column

    Thanks sktneer,
    Also your formulas are correct.
    Translated into Italian:
    =ANNULLA.SPAZI(SINISTRA(A2;MIN(TROVA({0;1;2;3;4;5;6;7;8;9};A2&"0123456789"))-1))
    =ANNULLA.SPAZI(RIMPIAZZA(A2;1;LUNGHEZZA(B2);""))
    max_max
    ------------------------------------------------------------------------------------
    Grazie sktneer,
    anche le tue formule sono corrette.
    Tradotte in Italiano:
    =ANNULLA.SPAZI(SINISTRA(A2;MIN(TROVA({0;1;2;3;4;5;6;7;8;9};A2&"0123456789"))-1))
    =ANNULLA.SPAZI(RIMPIAZZA(A2;1;LUNGHEZZA(B2);""))
    max_max

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

    Re: split txt in column

    Thanks for the feedback.

  14. #14
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: split txt in column

    Still don't understand:

    Using:

    B1 = TRIM(LEFT(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"))-1))

    C1 = TRIM(REPLACE(A1,1,LEN(B1),""))

    on Acciaio inox 304 7,93 gives:

    B1: Acciaio inox

    C1: 304 7,93

    I thought the desired result for this entry was:

    B1: Acciaio inox 304

    C1: 7,93

    Regards

  15. #15
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: split txt in column

    Using:

    B1 = TRIM(LEFT(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"))-1))

    C1 = TRIM(REPLACE(A1,1,LEN(B1),""))

    on Acciaio inox 304 7,93 gives:

    The result is:

    B1: Acciaio inox 304

    C1: 7,93

    max_max

  16. #16
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: split txt in column

    @max_max

    I don't see how that is a possible result on that string using that formula.

    Could you please re-check and/or post a workbook showing that result?

    Many thanks

  17. #17
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: split txt in column

    The workbook

    pesi_specifici.xls

    max_max

  18. #18
    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: split txt in column

    In B1 enter an array formula (Ctrl+Shift and Enter)

    =LEFT(A1,MAX((MID(A1,ROW($1:$100),1)=" ")*ROW($1:$100)))

    In C1

    =RIGHT(A1,LEN(A1)-SEARCH("^",SUBSTITUTE(A1," ","^",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))

    A
    B
    C
    1
    Materiali peso Kg/dm3 Materiali peso Kg/dm3
    2
    Acciaio al carbonio 7,85 Acciaio al carbonio 7,85
    3
    Acciaio comune 7,85 Acciaio comune 7,85
    4
    Acciaio inox 304 7,93 Acciaio inox 304 7,93
    5
    Acciaio inox 316 7,98 Acciaio inox 316 7,98
    6
    Acciaio inox 321 8,02 Acciaio inox 321 8,02
    7
    Acciaio inox 400 7,73 Acciaio inox 400 7,73
    8
    Acciaio laminato 7,85 Acciaio laminato 7,85
    9
    Acqua 1 Acqua 1
    10
    Acqua ossigenata 1,46 Acqua ossigenata 1,46
    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

  19. #19
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: split txt in column

    @max_max

    ? Precisely as I said. The results in your workbook for Acciaio inox 304 7,93 are:

    Column B: Acciaio inox

    Column C: 304 7,93

    and NOT

    Column B: Acciaio inox 304

    Column C: 7,93

    as you stated (and originally requested).

    Regards

  20. #20
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: split txt in column

    does this not work? no unnecessary arrays !
    and i agree with XOR LX
    Attached Files Attached Files

+ 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 to split one column into multiple column?
    By mithil in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-12-2015, 08:03 PM
  2. Macro to split one column into multiple column?
    By pravalika27 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-04-2013, 02:06 AM
  3. [SOLVED] split comma separated names in a column to a new column
    By letsxcel in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-16-2012, 10:45 AM
  4. [SOLVED] Split One Column at Delimiter While Copying Contents of Second Column to Populate New Rows
    By medailSacrosanct in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 08-01-2012, 11:37 AM
  5. [SOLVED] split name from 1 column to 2
    By giant in forum Excel General
    Replies: 2
    Last Post: 03-31-2012, 02:00 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