#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Sort function?

Excel does not appear to have a sort function.:-(

I can use the Sort option from the Data menu, but this has two major
problems:
1) The sort is only done once. If the data change, they don't stay
sorted.
2) If the data are calculated using a formula, sort doesn't work.

Any suggestions on the best way around this?
What I'm actually trying to do is create a workbook with various
calculations in. I just want people to be able to put their own data in the
first column, and have another column somewhere display the results of the
calculations (which involve sorting the data along the way).

If there was a sort function, this would be easy. For example I could put a
formula in cells B2:B5 something like =SORT(A2:A5). I expect I could write
such a function in VBA, but if anyone has any better ideas, or some code
that's already been written that would be very much appreciated.

Phil.


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Sort function?

I think I've found it. This seems to do the trick:

=SMALL(A2:A5,ROW()-1)


"Phil" <N/A wrote in message ...
Excel does not appear to have a sort function.:-(

I can use the Sort option from the Data menu, but this has two major
problems:
1) The sort is only done once. If the data change, they don't stay
sorted.
2) If the data are calculated using a formula, sort doesn't work.

Any suggestions on the best way around this?
What I'm actually trying to do is create a workbook with various
calculations in. I just want people to be able to put their own data in
the first column, and have another column somewhere display the results of
the calculations (which involve sorting the data along the way).

If there was a sort function, this would be easy. For example I could put
a formula in cells B2:B5 something like =SORT(A2:A5). I expect I could
write such a function in VBA, but if anyone has any better ideas, or some
code that's already been written that would be very much appreciated.

Phil.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 95
Default Sort function?

Phil,
have a look at the RANK formula. Together with MATCH and Offset you can
create a function based sort. Offset(Match(Rank()))

rdwj


"Phil" wrote:

I think I've found it. This seems to do the trick:

=SMALL(A2:A5,ROW()-1)


"Phil" <N/A wrote in message ...
Excel does not appear to have a sort function.:-(

I can use the Sort option from the Data menu, but this has two major
problems:
1) The sort is only done once. If the data change, they don't stay
sorted.
2) If the data are calculated using a formula, sort doesn't work.

Any suggestions on the best way around this?
What I'm actually trying to do is create a workbook with various
calculations in. I just want people to be able to put their own data in
the first column, and have another column somewhere display the results of
the calculations (which involve sorting the data along the way).

If there was a sort function, this would be easy. For example I could put
a formula in cells B2:B5 something like =SORT(A2:A5). I expect I could
write such a function in VBA, but if anyone has any better ideas, or some
code that's already been written that would be very much appreciated.

Phil.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sort function for dates does not sort properly in Office 2007 Exc. Rosalie Excel Worksheet Functions 1 November 22nd 07 10:25 PM
Sort : how can I use a variable in a VB sort function? El Bee Excel Worksheet Functions 3 February 16th 06 09:34 PM
sort function to sort for bell curve Kuby Excel Discussion (Misc queries) 4 December 16th 05 06:51 PM
Complicated sort function with sort and sum Matz Excel Worksheet Functions 3 August 29th 05 07:50 AM
Excel Sort function should not sort the cell formatting! Lisa D.N.1 Excel Worksheet Functions 1 December 28th 04 08:37 PM


All times are GMT +1. The time now is 12:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"