+ Reply to Thread
Results 1 to 3 of 3

3-level sorting including sorting a column by the number of percent sign in each cell

  1. #1
    Forum Contributor
    Join Date
    04-04-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    204

    3-level sorting including sorting a column by the number of percent sign in each cell

    Hi All,

    I have one worksheet that contains over 80,000 rows of data distributed across 4 columns A-D.

    As per attached example:

    Sheet1 has a sample unsorted data, where ColD has the core data for this question.

    ColD has names of subjects preceded a "%" char. Each cell in ColD has a variable number of names of subjects. ColD is needed to be sorted ascending according to the number of names of subjects per each cell.

    Because the name of each subject is consisted of several words, a "%" sign is added before the subject's name, so that the number of percent signs in each cell is used to sort the entire column. I manually counted % signs as: 8, 22, 4, 2, 3, 7 and 15.


    Sheet2 has the same sample data sorted as desired. A three-level ascending sorting is applied for ColA, ColB and ColD where the number of percent signs is used to sort ColD.

    Can this process be applied on the real large data by a smart code that counts % signs and sort data accordingly?

    I do appreciate any valuable assistance with this request.

    Many thanks in advance.

    T.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,952

    Re: 3-level sorting including sorting a column by the number of percent sign in each cell

    Use a column of formulas like this for your third level sort:

    =LEN(D2)-LEN(SUBSTITUTE(D2,"%",""))

    That formula will return the number of % characters in cell D2.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Contributor
    Join Date
    04-04-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    204

    Re: 3-level sorting including sorting a column by the number of percent sign in each cell

    Certainly yes Bernie. This is a genius, simple and perfect solution.
    Thank you very much for your invaluable input to my problem which does not exist any more after applying your formula.
    Please accept my deep gratitude and thanking.

    All the best.

    T.

+ 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. Sorting 2 data ranges by comparing one column in each and sorting to match
    By MDKsmiffy in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-17-2013, 03:30 PM
  2. Sorting a range to invert it upside down without sorting by any specific column
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-29-2013, 12:53 PM
  3. [SOLVED] Sorting a range to invert it upside down without sorting by any specific column
    By luv2glyd in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-28-2013, 12:43 PM
  4. 2 level sorting
    By PvanS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-05-2009, 04:22 AM
  5. converting a number to percentage with the percent sign
    By rwab in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-17-2008, 04:35 PM
  6. [SOLVED] Formatting a number to look like a Percent without a percent sign
    By David Iacoponi in forum Excel General
    Replies: 2
    Last Post: 09-15-2005, 02:05 PM

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