+ Reply to Thread
Results 1 to 11 of 11

Sorting multiple columns using formulas only

  1. #1
    Registered User
    Join Date
    10-03-2011
    Location
    Vancouver, bC
    MS-Off Ver
    Excel 2007
    Posts
    4

    Sorting multiple columns using formulas only

    I am trying to mimic the sort and filter function using a formula for multiple columns, using the numeric values in descending order. See example attached.

    (Column A) contains a range of text values.
    (Column B) contains a range of unsorted numbers.

    I am able to sort the numerical values in descending order, using the LARGE and ROW functions as shown in the following formula (in cell G2):

    =LARGE($B$2:$B$17,ROW()-ROW($G$2)+1)

    Now I would like to find a way of having the text values correspond with the sorted numerical data in the next column (H2). Can anyone help?
    Attached Files Attached Files
    Last edited by mm_crown; 10-05-2011 at 10:16 PM.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Sorting multiple columns using formulas only

    Try this

    =INDEX($A$4:$A$19,MATCH(G4,$B$4:$B$19,0)+COUNTIF($G$4:G4,G4)-1) dragged down
    Does that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    10-03-2011
    Location
    Vancouver, bC
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Sorting multiple columns using formulas only

    Hey ChemistB,

    For most part the formula you provided worked. Most of the cells text copied accurately, though there was one error and I can't figure out why. I've copied your formula into the attached spreadsheet, and have highlighted the error. Maybe you can let me know why this didn't work out completely.

    I am now thinking that this error has to do with the fact that the array needs the values to be sorted in ascending order so that the duplicates are right below each other so that the countif portion works. Let me know if this is accurate, and if there is a way of doing this without having to sort the initial data.
    Attached Files Attached Files
    Last edited by mm_crown; 10-05-2011 at 04:14 AM.

  4. #4
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    157

    Re: Sorting multiple columns using formulas only

    The sort can be achieved using either an array formula, see first sheet in attached doc, or using a helper column, see second sheet.

    Beau Nydal
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Sorting multiple columns using formulas only

    That's correct mm. I assumed that, as per your example, the ranking was initially sorted from low to high. Beaunydal has aptly provided 2 solutions for non-sorted systems.

  6. #6
    Registered User
    Join Date
    10-03-2011
    Location
    Vancouver, bC
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Sorting multiple columns using formulas only

    Thanks to everyone for the assistance with this problem. I have utilized the solution provided, and everything works perfectly now. Thanks again. mm_crown
    Last edited by mm_crown; 10-05-2011 at 10:18 PM.

  7. #7
    Registered User
    Join Date
    11-13-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Sorting multiple columns using formulas only

    I need this option too.
    Thx

  8. #8
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Sorting multiple columns using formulas only

    XXX7

    Pls start your own thread-as per forum rules- explaining of course much more which is your issue.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

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

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  9. #9
    Registered User
    Join Date
    10-29-2014
    Location
    Hyderabad
    MS-Off Ver
    2007
    Posts
    1

    Re: Sorting multiple columns using formulas only

    Thank You Very Beaunydal

  10. #10
    Registered User
    Join Date
    07-04-2019
    Location
    Portugal
    MS-Off Ver
    OFFICE 2013
    Posts
    2

    Re: Sorting multiple columns using formulas only

    How can i open php files? When I try to download this attachment it gives me na php file, and i don't know how to open it...

  11. #11
    Registered User
    Join Date
    07-04-2019
    Location
    Portugal
    MS-Off Ver
    OFFICE 2013
    Posts
    2

    Re: Sorting multiple columns using formulas only

    How can i open this *.php file???

    Quote Originally Posted by beaunydal View Post
    The sort can be achieved using either an array formula, see first sheet in attached doc, or using a helper column, see second sheet.

    Beau Nydal

+ 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