#1   Report Post  
Patrick Simonds
 
Posts: n/a
Default Sorting problem

I have a worksheet with 5 columns and 5 rows. A number gets entered into
each cell (A1:E5). I need to sort so that each number is placed in
sequential order (smallest to largest) across the columns and down the rows
(see example below). Can this be done?


1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25


  #2   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

Patrick,

You could use another block of formulas, which wouldn't affect the original
entries, but could be used in their place. Enter this into cell G1, then
copy to G1:K5.

=SMALL($A$1:$E$5,(ROW()-ROW($G$1))*5+COLUMN()-COLUMN($G$1)+1)

Or you could use a macro: see macro code below.

HTH,
Bernie
MS Excel MVP

Sub BlockSort()
Dim i As Integer

Range("A1").EntireColumn.Insert

For i = 2 To 6
Cells(1, i).Resize(5, 1).Copy _
Range("A65536").End(xlUp)(2)
Next i

Range(Range("A2"), Range("A2").End(xlDown)).Sort _
Key1:=Range("A2"), Order1:=xlAscending, Header:=xlNo

For i = 2 To 6
Cells((i - 2) * 5 + 2, 1).Resize(5, 1).Copy
Range("B" & (i - 1)).PasteSpecial Transpose:=True
Next i

Range("A1").EntireColumn.Delete

End Sub



"Patrick Simonds" wrote in message
...
I have a worksheet with 5 columns and 5 rows. A number gets entered into
each cell (A1:E5). I need to sort so that each number is placed in
sequential order (smallest to largest) across the columns and down the

rows
(see example below). Can this be done?


1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25




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
Sorting problem, sums change Mychele Excel Discussion (Misc queries) 1 February 5th 05 03:45 PM
Sorting problem JC Excel Discussion (Misc queries) 3 January 28th 05 03:27 AM
Difficult Sorting Problem Rob Excel Discussion (Misc queries) 2 January 5th 05 03:05 PM
Crazy Sorting Problem..... Neal Excel Discussion (Misc queries) 1 December 30th 04 06:56 PM
Sorting problem Klaus Excel Discussion (Misc queries) 3 December 4th 04 01:55 AM


All times are GMT +1. The time now is 11:43 AM.

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

About Us

"It's about Microsoft Excel"