Closed Thread
Results 1 to 9 of 9

sorting numbers into ascending order

  1. #1
    Registered User
    Join Date
    04-25-2007
    Posts
    3

    sorting numbers into ascending order

    Hi All

    I am currently writing a visual basic program which will input 100 random numbers into excell. Is there any function that will automatically arange them into ascending order?

    Somethign like =SORT(A1:a100)

    Anyones input is greatly appriciated.

    Regards
    Stephen

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482
    Please Login or Register  to view this content.

    this code will auto sort column A starting from A2

    Copy and paste it in the worksheet module

  3. #3
    Registered User
    Join Date
    04-25-2007
    Posts
    3
    Thnak you dave for that reply. Not sure if it is what im looking for though. What i am reading in from the vb program i want to keep random but would like to sort say for example this is the read in data

    coloum 1
    6
    7
    1
    2
    6
    7
    8

    I would like to sort this in excell automatically
    coloum 2
    1
    2
    6
    6
    7
    7
    8

    Anyone any idea on how i could do this?
    Any help greatly appriciated.

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482
    Quote Originally Posted by stevy123
    Thnak you dave for that reply. Not sure if it is what im looking for though. What i am reading in from the vb program i want to keep random but would like to sort say for example this is the read in data

    coloum 1
    6
    7
    1
    2
    6
    7
    8

    I would like to sort this in excell automatically
    coloum 2
    1
    2
    6
    6
    7
    7
    8

    Anyone any idea on how i could do this?
    Any help greatly appriciated.
    Please Login or Register  to view this content.
    change to

    Please Login or Register  to view this content.
    and

    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-25-2007
    Posts
    3
    Thanks again dave,

    Sorry to sound really ungrateful but its not vb i want to do the working out. I am looking to make excell do the working out of sorting the numbers into ascending order and move them from coloum a to coloum b.

    Is there a function similar to min(A1:A10)

    its somethign like that i am after but to sort the likes of

    coloum a
    7
    8
    1
    2
    3

    and put it into coloum b as
    1
    2
    3
    7
    8

    thanks steve

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482
    Hi Steve,

    Here is one way you could do it, using the large function

    Assuming your data starts in row 1

    =LARGE($A$1:$A$5,COUNTA(A:A)-(COUNTA(A:A)-ROW()))

    This counts the number of values in Column A
    Then subtracts the number of values in column A less the row number
    ei: if this formula is in B1
    counts the number of values in column A
    less the # of values in column A less 1
    to get 1
    the same as

    =LARGE($A$1:$A$10,1)
    =LARGE($A$1:$A$10,2)
    =LARGE($A$1:$A$10,3)
    =LARGE($A$1:$A$10,4)
    =LARGE($A$1:$A$10,5)

  7. #7
    Registered User
    Join Date
    04-03-2012
    Location
    indore,india
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: sorting numbers into ascending order

    Quote Originally Posted by davesexcel View Post
    Please Login or Register  to view this content.

    this code will auto sort column A starting from A2

    Copy and paste it in the worksheet module
    hii dave

    I am not able to find the worksheet module, please help me.
    Last edited by arlu1201; 04-03-2012 at 08:32 AM.

  8. #8
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: sorting numbers into ascending order

    Quote Originally Posted by [email protected] View Post
    hii dave

    mujhe worksheet module nahi mil raha hai plz help me
    I assume you are asking where the worksheet module is?
    Right click on the sheet tab and select View Codes
    Paste the code there.

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: sorting numbers into ascending order

    Welcome to the Forum, Deep_cool98, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    Last edited by Vaibhav; 04-03-2012 at 08:05 AM.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

Closed 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