+ Reply to Thread
Results 1 to 18 of 18

Copy cells containing word into second column

  1. #1
    Registered User
    Join Date
    11-27-2012
    Location
    Teplice
    MS-Off Ver
    2010
    Posts
    71

    Question Copy cells containing word into second column

    Hi,

    please can you type me macro that will find in all A:A column words containing "." and put them into the second column?
    Also, in third column, I would like to have all words, except all what is after "."

    Example:

    A B C
    aaa aaa
    aa.a aa.a aa
    bbb bbb
    bbb bbb
    ccc ccc
    cc.c cc.c cc

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Copy cells containing word into second column

    attach please a sample file with result you want
    If solved remember to mark Thread as solved

  3. #3
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Copy cells containing word into second column

    run the macro
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    11-27-2012
    Location
    Teplice
    MS-Off Ver
    2010
    Posts
    71

    Re: Copy cells containing word into second column

    weel, in example seems to be OK, but if i use for example these values

    text 1410.2497
    text 1410.2762
    text 1410.2801
    text 1410.2817
    text 1410.2936
    text 1410.2954


    Than it is not working right. :-(

  5. #5
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Copy cells containing word into second column

    I imagine the reason is that the B columns contain numbers, I'll include that option

  6. #6
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Copy cells containing word into second column

    try it now
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-27-2012
    Location
    Teplice
    MS-Off Ver
    2010
    Posts
    71

    Re: Copy cells containing word into second column

    Hmmm,

    working better, but i d like you to help me correct last trinket.

    When the script runs, the results are bad in this

    text1419
    text 1410
    text 1410.2497
    text 1410.2762
    text 1410.2801
    text 1410.2817
    text 1410.2936
    text 1410.2954

    in b column removes "text"
    also in b column the text is starting with " " and this space i dont want here...
    the B column i need to be there only copied all the text, which is in A column

    so B should be like (for example as above)

    text 1410.2497
    text 1410.2762
    text 1410.2801
    text 1410.2817
    text 1410.2936
    text 1410.2954

    in c column, there is not seen 1410 (i want the script leaves me all before "-" for C column
    also space is there

    so C column should be like (for example as above)

    text1419
    text 1410
    text 1410
    text 1410
    text 1410
    text 1410
    text 1410
    text 1410


    Please do this last favour for me

    Thank you

  8. #8
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Copy cells containing word into second column

    I think it does as requested this time...
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    11-27-2012
    Location
    Teplice
    MS-Off Ver
    2010
    Posts
    71

    Lightbulb Re: Copy cells containing word into second column

    Great, this code of yours works excelent for me.

    I will put it here also if someone will want to see it - but i declare, this work were done just by RCM

    Thank you very much, you saved me lot of time

    Please Login or Register  to view this content.

  10. #10
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Copy cells containing word into second column

    I am glad we finally got it!!! Cheers,

  11. #11
    Registered User
    Join Date
    11-27-2012
    Location
    Teplice
    MS-Off Ver
    2010
    Posts
    71

    Re: Copy cells containing word into second column

    Quote Originally Posted by rcm View Post
    I am glad we finally got it!!! Cheers,
    Oi, i have found out, that after cells containing "." dot, in B column will remain all words with dot.... this must be some mistake in code...or?

  12. #12
    Registered User
    Join Date
    11-27-2012
    Location
    Teplice
    MS-Off Ver
    2010
    Posts
    71

    Re: Copy cells containing word into second column

    Quote Originally Posted by rcm View Post
    I am glad we finally got it!!! Cheers,
    Oi, i have found out, that after cells containing "." dot, in B column will remain all words with dot.... this must be some mistake in code...or?

  13. #13
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Copy cells containing word into second column

    odeen: the code renders exactly what you posted in #7

  14. #14
    Registered User
    Join Date
    11-27-2012
    Location
    Teplice
    MS-Off Ver
    2010
    Posts
    71

    Re: Copy cells containing word into second column

    yes, but if in A column will be more variables - and i have there about 20k variables, than it is problem


    try this

    text1419
    text 1410
    text 1410.2497
    text 1410.2762
    text 1410.2801
    text 1410.2817
    text 1410.2936
    text 1410.2954
    text 1411
    text 1421
    text 1421x.3
    text 1433

    B column should not have generate 1411, 1421 and so on

    C column is OK

  15. #15
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Copy cells containing word into second column

    there was an error I was missing a "j=0" See it is the work of two..
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    11-27-2012
    Location
    Teplice
    MS-Off Ver
    2010
    Posts
    71

    Re: Copy cells containing word into second column

    Hmmm,

    as i am testing it on main database i see two things are still not as i d like to - i am sorry :-)

    In B column

    now all values with "." are bellow, so that they dont belong to the value to the left side (A column) - i need them to be in the same row
    and one easy thing
    can the script beggin at second row?

    Thank you very much for your patience

  17. #17
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Copy cells containing word into second column

    there we go!!!
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    11-27-2012
    Location
    Teplice
    MS-Off Ver
    2010
    Posts
    71

    Re: Copy cells containing word into second column

    just........



    GREAT WORK




    thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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