Sorting rows horizontally

K

K. Georgiadis

I have a medium sized data base, organized as shown below:

Column A Column B Column C Column D Column E

Success % 85 80 75 77
Price 1.25 1.10 2.18 1.50
Yield rate 150 140 145 148

etc. etc.

I'm looking for a formula or routine that will
sequentially arrange the values of each row from low to
high, leaving the labels in column A untouched
 
R

RagDyer

If I understand what you're asking, you -*don't* want to keep the columns
together?
The 85 and 1.25 and 150 are separate entities and *not* a group, and if they
end up in different columns, that's OK?

If that's so, then simply sort the row.

Select B1:E1
<Data> <Sort> <Continue W/CurrentSelectionm>
<Options> button, click "SortLeftToRight", <OK> <OK>.

If you *do* wish to keep the columns together, then select,
B1:E5
<Data> <Sort> <Options> button, click "SortLeftToRight", <OK>
Choose the row you wish to be the sort key, then <OK>.
--

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================

I have a medium sized data base, organized as shown below:

Column A Column B Column C Column D Column E

Success % 85 80 75 77
Price 1.25 1.10 2.18 1.50
Yield rate 150 140 145 148

etc. etc.

I'm looking for a formula or routine that will
sequentially arrange the values of each row from low to
high, leaving the labels in column A untouched
 
K

K. Georgiadis

You are right in that only the label and numbers for each
row constitute an entity and that it is quite alright
that the numbers end up in different columns. In fact,
that is the desired effect, because I want Column B to
show the lowest and Column D the highest values of each
row.
The manual sort that you suggested is how I have sorted
the data initially but, since the data is likely to
change several times, I'm looking for a macro/VBA
procedure that will (a) sort the first row (b) move down
and sort the second row, and so forth, with a single
command.
 
D

dnickelson

Try this?

Sub SortHorizontal()

For r = 1 To 3 'rows to sort
sortcol = "B" & r
Range(Cells(r, 2), Cells(r, 5)).Select
Selection.Sort Key1:=Range(sortcol), Order1:=xlAscending
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
_
DataOption1:=xlSortNormal
Next
End Su
 
Top