Sort left to right on five cells in a row, then next row

snowdrift

New Member
Joined
Sep 21, 2006
Messages
3
I have five numeric values that are are in no particular order going from left to right, like:

ROW 1: 5 15 19 10 25
ROW 2: 5 2 34 13 5
ROW 3: 15 19 16 1 13

I know how to sort these from left to right ascending on a row-by-row basis.

But... how can I sort multiple rows' worth of such data all at once, keeping each row's sort segrated from the other rows?
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
I am trying to avoid using VB if possible. I did find this one solution:

http://www.mvps.org/dmcritchie/excel/sorting.htm

Sorting a selection by Rows, with each Row being independent of the other rows

The following is based on Tom Ogilvy's example but has been made a bit more generic to process a Selection instead of a specific Range. Example shows a single selection area, modified to distinguish rows.

Sub sortEachRow()
'based on Tom Ogilvy, 2001-03-24, Programming
Dim rw As Range
If Selection.Columns.Count = 1 Then
MsgBox "your selection must involve more" _
& " than one cell or column"
Exit Sub
End If
For Each rw In Selection.Rows
rw.Sort key1:=rw, Order1:=xlAscending, _
Header:=xlNo, OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlLeftToRight
Next
End Sub
 
Upvote 0
If your data is in A1 to E1` then place these formulas in cells F1 to J1:

F1 =SMALL($A1:$E1,1)
G1 =SMALL($A1:$E1,2)
H1 =SMALL($A1:$E1,3)
I1 =SMALL($A1:$E1,4)
J1 =SMALL($A1:$E1,5)
 
Upvote 0
That works, Doug!

Thank you for your easy-to-implement solution! It worked great.

I appreciate the help.
 
Upvote 0

Forum statistics

Threads
1,214,952
Messages
6,122,457
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top