+ Reply to Thread
Results 1 to 15 of 15

How to factor strings?

  1. #1
    Forum Contributor
    Join Date
    12-30-2012
    Location
    Israel
    MS-Off Ver
    2007, 2016
    Posts
    642

    How to factor strings?

    Hello. I need to factor strings like: "a_t(a) 2012-11-25 17:30:03.221 497 0". Currently the string is placed in one messy cell. I marked each data I need to copy to new separate cells. Problem is that I have many rows like this, and they are not similar in their size. So I cannot simply use functions like "Left". Any idea?
    Last edited by GIS2013; 08-13-2013 at 05:02 AM.

  2. #2
    Forum Contributor
    Join Date
    06-26-2013
    Location
    LAX
    MS-Off Ver
    Excel 2007,Excel 2010
    Posts
    363

    Re: How to factor strings?

    Hello,

    To understand your need, can you please attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

  3. #3
    Forum Contributor
    Join Date
    12-30-2012
    Location
    Israel
    MS-Off Ver
    2007, 2016
    Posts
    642

    Re: How to factor strings?

    Ela, please see enclosed file.
    Attached Files Attached Files

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

    Re: How to factor strings?

    Hi,

    I notice that all of the desired parts to be returned are separated by a tab character (CHAR(9)) in the original string - is this always the case, or have you manually inserted them yourself to try to illustrate your point?

    Regards
    Click * below if this answer helped

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

  5. #5
    Forum Contributor
    Join Date
    06-26-2013
    Location
    LAX
    MS-Off Ver
    Excel 2007,Excel 2010
    Posts
    363

    Re: How to factor strings?

    Similar to XOR LX question, do you copy paste the original date details here. Because when i copy paste the input date into notepad, it has lot of spaces in between.

  6. #6
    Forum Contributor
    Join Date
    12-30-2012
    Location
    Israel
    MS-Off Ver
    2007, 2016
    Posts
    642

    Re: How to factor strings?

    Hi XOR,

    I really don't know, sorry..

    To me the original string looks like a mess. All I know is that I need to separate it into meaningful columns in order to work on it with the pivot tool.

  7. #7
    Forum Contributor
    Join Date
    12-30-2012
    Location
    Israel
    MS-Off Ver
    2007, 2016
    Posts
    642

    Re: How to factor strings?

    Oh yeah - sorry, didn't understand XOR's question - I did copy pieces out of the original string.

  8. #8
    Forum Contributor
    Join Date
    06-26-2013
    Location
    LAX
    MS-Off Ver
    Excel 2007,Excel 2010
    Posts
    363

    Re: How to factor strings?

    Ok. If possible can you attach a sample of the original string, that is before you copy.
    desensitize any data..

  9. #9
    Forum Contributor
    Join Date
    12-30-2012
    Location
    Israel
    MS-Off Ver
    2007, 2016
    Posts
    642

    Re: How to factor strings?

    I hope this will help.
    Attached Files Attached Files

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

    Re: How to factor strings?

    Ok, so back to my original question: I presume that this string has been pasted/exported from some other source? Will this always be the case, i.e. will your data in Excel always be of this form, as a result of exporting/pasting?

    If that's the case, then we can use this tab character to split your data. With a string in A1, enter this formula in B1 and copy across to the right as sufficiently far as necessary:

    =TRIM(MID(SUBSTITUTE($A1,CHAR(9),REPT(" ",255)),255*(COLUMNS($A:A)-1)+1,255))

    I have no idea how you are translating the 0 as "Sunday" in your desired outcome, nor where the final month string is to be found.

    Regards

  11. #11
    Forum Contributor
    Join Date
    06-26-2013
    Location
    LAX
    MS-Off Ver
    Excel 2007,Excel 2010
    Posts
    363

    Re: How to factor strings?

    Question2 excel file doesn't help much.

    So I guess, they way to deal this is.

    Copy the original date / column from excel.

    Open ms-word, new document.
    Select paste-paste special -formatted text (RTF)
    Select the text with ctrl+A,
    go to insert ->table-->convert text to table.
    Now you can see the text has been converted into columns.


    Copy the table from ms-word and paste back in excel. Make sure to adjust the excel column formats per the need.

    Did that work?

  12. #12
    Forum Contributor
    Join Date
    12-30-2012
    Location
    Israel
    MS-Off Ver
    2007, 2016
    Posts
    642

    Re: How to factor strings?

    First thanks,

    Quote Originally Posted by XOR LX View Post
    Ok, so back to my original question: I presume that this string has been pasted/exported from some other source? Will this always be the case, i.e. will your data in Excel always be of this form, as a result of exporting/pasting?
    I am the end-user here, and I don't know what software the company that sends me the data uses. Usually I receive the data already separated into coulmns (route - like you did, but also time, day etc), not this time, and I'm having problem getting from them the data on time (in their usual form).

    If that's the case, then we can use this tab character to split your data. With a string in A1, enter this formula in B1 and copy across to the right as sufficiently far as necessary:

    =TRIM(MID(SUBSTITUTE($A1,CHAR(9),REPT(" ",255)),255*(COLUMNS($A:A)-1)+1,255))
    This is very helpful but it extracts only the route name.. Any chance I could extract all the other parameters?

    I have no idea how you are translating the 0 as "Sunday" in your desired outcome, nor where the final month string is to be found.
    If I can get 0 in a separate cell, it's not a problem to write an If function - if 0 then sunday etc..
    Last edited by GIS2013; 08-13-2013 at 07:34 AM.

  13. #13
    Forum Contributor
    Join Date
    12-30-2012
    Location
    Israel
    MS-Off Ver
    2007, 2016
    Posts
    642

    Re: How to factor strings?

    XOR. Now I get it. I just need to drag the function you've written to the right, and it brings out the parameters. You're gorgeous!

  14. #14
    Forum Contributor
    Join Date
    12-30-2012
    Location
    Israel
    MS-Off Ver
    2007, 2016
    Posts
    642

    Re: How to factor strings?

    Ela, thanks to you too.

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

    Re: How to factor strings?

    You're welcome!

+ 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: 2
    Last Post: 03-07-2013, 02:34 AM
  2. Replies: 9
    Last Post: 12-21-2012, 04:18 AM
  3. [SOLVED] loop to match if shorter strings appears in longer strings
    By mcdermott2 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-19-2012, 08:07 PM
  4. Replies: 5
    Last Post: 02-15-2012, 09:57 AM
  5. Replies: 3
    Last Post: 05-28-2011, 01:43 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