+ Reply to Thread
Results 1 to 6 of 6

Sort on number of words (words with least characters first)

  1. #1
    Registered User
    Join Date
    11-23-2012
    Location
    vancouver, bc
    MS-Off Ver
    Excel 2007
    Posts
    4

    Sort on number of words (words with least characters first)

    Hello, I was looking for this kind of code, I found this post, Thanks a lot, works like magic,
    the post is more than 2 years old and I am not sure if anyone can help me out with the problem I have.

    how about if you have more than one column in your worksheet, and you don't want to shuffle the data ,
    I have already tried it, data on other column remains untouched, so it the data is not useful, I tried using Sort Button and over there no option to make it sort on one column while holding another column,
    perhaps there is an easier way to do it,
    i can not figure it out how to make this code works while having more then one column of data.
    any idea how I can expand the sort as well?
    appreciate it.
    Last edited by jeffreybrown; 11-23-2012 at 05:46 PM.

  2. #2
    Forum Contributor Steve N.'s Avatar
    Join Date
    12-22-2011
    Location
    USA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    298

    Re: Sort on number of words (words with least characters first)

    If you could upload a sample worksheet - that would be most helpful

  3. #3
    Registered User
    Join Date
    11-23-2012
    Location
    vancouver, bc
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Sort on number of words (words with least characters first)

    thank you for your response,
    the data that I am going to try is data from Google keyword tool, I attach a sample file csv file zipped.



    thanks
    Attached Files Attached Files

  4. #4
    Forum Contributor Steve N.'s Avatar
    Join Date
    12-22-2011
    Location
    USA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    298

    Re: Sort on number of words (words with least characters first)

    I'm having trouble understanding what you are trying to do and what result you want.

  5. #5
    Registered User
    Join Date
    11-23-2012
    Location
    vancouver, bc
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Sort on number of words (words with least characters first)

    thank you for your response,
    I try to explain,
    in this post a code has been shared for sorting one column of keyword based on the number of words,
    that works, when you have one column of keywords, you make second column (B) for the code, copy you code in the second column then selecting two columns and sort by the column B as described in the post. your column of keyword will be sorted out, least keyword first.,

    there is no other column in the test.

    and here is the code:
    =VALUE(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))+1 & "." & TEXT(LEN(A1),"0000"))
    now if you have a worksheet that has more than one column like the one I attached, when you want to sort your data, lets say sorting the first column alphabetically (which is keyword column),
    you simply select your column and click sort e.g. A-Z, the the column is sorted alphabetically, data on other columns will also be sorted correctly, ( if you select Expand the selection ) so no data is mismatched when your read your data row by row.

    Now I want to apply the same code for the sample worksheet that I attached, but since my worksheet has more than one column, excel does not let me select two column and sort.
    I want to use this code to sort my column of keyword and also keep data on other columns in tact.

    hopefully I could explain it properly.
    thanks

  6. #6
    Registered User
    Join Date
    11-23-2012
    Location
    vancouver, bc
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Sort on number of words (words with least characters first)

    OK it works now, since I don't know much about excel, so I could not figure it out.
    here is how,
    I made a new column between the A and B, so now the new column becomes column B,
    copy the code to the first cell of column B, and drag it down until the last row of
    data,
    select the first cell on column A, click on Sort & filter and select Custom sort, now add
    click Add level, on the first level select column B, and on the second level select Column A
    sorted should be on value
    click OK, and it works

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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