![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: May 2002
Posts: 1
|
I have a spreadsheet with multiple numerical columns. I need a way to automate it so each column will have its information ranked best to worst (1 to 30) without having to go through and sort and rank each one seperately.
|
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
Try the following:
Sub SortCols() Dim cols As String, col As String cols = InputBox("Enter the columns you want to sort without spaces") For i = 1 To Len(cols) col = Mid(cols, i, 1) Columns(col).Sort Key1:=Range(col & "1"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal Next End Sub
__________________
Kind regards, Al Chara |
|
|
|
|
|
#3 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
|
Quote:
then in B1 enter the following array formula =LAREGE(A1:A30,ROW(1:30)) then highlite cells B1:B30 and array enter --that is key in CTRL+SHIFT+ENTER Cells B1:B30 will have all the entries of cells A1:A30 arranged in descending order. And now whenever a value changes in range A1:A30, B1:B30 descending order is dynamically adjusted. Please post back if it works for you ... otherwise explain a little further and let us take it from there. Regards!
__________________
Regards! Yogi Anand, D.Eng, P.E. Energy Efficient Building Network LLC www.energyefficientbuild.com |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|