+ Reply to Thread
Results 1 to 8 of 8

How to sort values in a row by using Array method

  1. #1
    Forum Contributor
    Join Date
    08-12-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2013, 2019 & O365
    Posts
    214

    How to sort values in a row by using Array method

    Hi All,

    I have a rate list in some columns, and I want to sort the rate in ascending order as per the rows (row wise), so the highest rate should be in column A and the lowest rate will be in the last column.

    Please let me know how can I assign Array (ReDim) on it or then do a bubble or quick sort or anything the best method.

    Please note, the count of columns and rows can be increased or decreased in other files.

    Thanks !
    SunOffice
    Last edited by SunOffice; 11-19-2013 at 01:47 AM.
    Excelforum is Completely Awesome! True learning with Live Examples & Best Techniques!!

  2. #2
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: How to sort values in a row by using Array method

    Hi SunOffice,
    this is the slowest method, but it works 0.06 seconds at your example
    Please Login or Register  to view this content.

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

    Re: How to sort values in a row by using Array method

    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: How to sort values in a row by using Array method

    Arrange of QuickSort, took 0.01x to 0.02x sec on your data.
    Please Login or Register  to view this content.

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: How to sort values in a row by using Array method

    Hi, SunOffice,

    just for curiosity: what´s wrong with the normal Sort routine which could sort on Columms as well that you would need an Array to do the job?

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  6. #6
    Forum Contributor
    Join Date
    08-12-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2013, 2019 & O365
    Posts
    214

    Re: How to sort values in a row by using Array method

    Thank you nilem!
    Your method is very good and simple to understand, ...I like it!

  7. #7
    Forum Contributor
    Join Date
    08-12-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2013, 2019 & O365
    Posts
    214

    Re: How to sort values in a row by using Array method

    Thank you jindon!
    This is somewhat I was also looking for the advanced level learning.

  8. #8
    Forum Contributor
    Join Date
    08-12-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2013, 2019 & O365
    Posts
    214

    Re: How to sort values in a row by using Array method

    Hi patel45 ==>> Thank you for the help! I was looking for the sorting of Arrays by ascending and descending methods, and would also like you to explain the method/trick for your line " ' now you can use arr for sorting".

    Hi HaHoBe ==>> Thank you for the idea! Actually there are two reasons - 1st) I did find the any way to sort on column values, which is already in Excel's data tab menu. 2nd) I am keen to learn the advanced trick of sorting Arrays.

    With Regards,
    SunOffice

+ 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. [SOLVED] Array formula to extract and sort unique values from two worksheets
    By rshukla in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-07-2013, 06:11 AM
  2. Use sort method to sort ranges based on their headings using vba
    By kris nuvio in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-01-2013, 07:54 AM
  3. Sort and Hide Unused Array Values
    By Phoenix5794 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-21-2012, 04:15 PM
  4. sort method
    By mkyb14 in forum Excel General
    Replies: 1
    Last Post: 02-12-2007, 04:53 PM
  5. Help with Sort Method
    By turnerje in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2005, 05: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