ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sort an array (https://www.excelbanter.com/excel-programming/285470-sort-array.html)

clui[_15_]

sort an array
 
What's the code for sorting an array? For example, my array looks lik
this: <20, <5, <60, <9. I want to have it in this order: <5, <9, <20
<60.

Thanks

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

sort an array
 
your values appear to be text. Text would sort as

<20
<5
<60
<9

If you want a numberical sort, you could insert a column next to your data
and use a formula like

=--(Right(A1,Len(A1)-1) [drag fill down the column]

Then sort both columns using the column with the formulas as the sort key.

--
Regards,
Tom Ogilvy


"clui" wrote in message
...
What's the code for sorting an array? For example, my array looks like
this: <20, <5, <60, <9. I want to have it in this order: <5, <9, <20,
<60.

Thanks!


---
Message posted from http://www.ExcelForum.com/




nigelbellamy

sort an array
 
Further to the answer below i am not quite clear how that answer sorts
an array. It appears to sort a range.

I have a similar problem:

How do i sort an array which contains 7 columns and 1,000,000 rows of
numeric data.
I bascially need to re-order the rows in ascending order based on the
value of the final column in the row.

eg.
1,1,2,3,4,6,99.78
2,3,4,5,6,1,12.34
2,1,3,4,2,2,10000.56
...

to give:
2,3,4,5,6,1,12.34
1,1,2,3,4,6,99.78
2,1,3,4,2,2,10000.56
...

How do i then take the top 50 rows into excel and delete the rest?

Thanks

N


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 01:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com