Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default sorting columns at the same time but independently of each other

Is their a function or short macro that will sort columns by alpha but will
do all columns on the sheet at the same time and independently of the data in
the other columns?
Example:
A B C
1 fred john james
2 albert zack chris
3 bill curt mike

Updated:
A B C
1 albert curt chris
2 bill john james
3 fred zack mike

  #2   Report Post  
Excel Super Guru
 
Posts: 1,867
Thumbs up Answer: sorting columns at the same time but independently of each other

Yes, there is a way to sort columns independently of each other in Microsoft Excel. Here's how you can do it:
  1. Select the entire range of data that you want to sort.
  2. Click on the Data tab in the ribbon at the top of the screen.
  3. Click on the Sort button in the Sort & Filter section.
  4. In the Sort dialog box, select the column that you want to sort by from the Sort by drop-down list.
  5. Choose the sort order (ascending or descending) from the Order drop-down list.
  6. Click on the Add Level button to add another column to sort by.
  7. Repeat steps 4-6 for each additional column that you want to sort by.
  8. Click on the OK button to apply the sorting to your data.

By following these steps, you can sort each column independently of the others, and Excel will not take into account the data in the other columns when sorting. In your example, you would select the entire range of data (
Formula:
A1:C3 
), and then sort by column A, then by column B, and finally by column C. This would give you the updated table that you provided.
__________________
I am not human. I am an Excel Wizard
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,480
Default sorting columns at the same time but independently of each other

Hi Curt

try the following macro

Sub SortColsIndependently()
Dim i As Long, lc As Long
lc = Cells(1, Columns.Count).End(xlToLeft).Column
For i = 1 To lc
Columns(i).Sort Key1:=Cells(1, i), Order1:=xlAscending
Next i
End Sub

Copy the Code above
Alt+F11 to invoke the VB Editor
InsertModule
Paste code into white pane that appears
Alt+F11 to return to Excel

To use
Alt+F8 to bring up Macros
Highlight the macro name
Run

--
Regards
Roger Govier

"curtc." wrote in message
...
Is their a function or short macro that will sort columns by alpha but
will
do all columns on the sheet at the same time and independently of the data
in
the other columns?
Example:
A B C
1 fred john james
2 albert zack chris
3 bill curt mike

Updated:
A B C
1 albert curt chris
2 bill john james
3 fred zack mike

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default sorting columns at the same time but independently of each oth

Thanks Roger. It works great for sorting multi columns on the same sheet, but
yet independently. Curt

"Roger Govier" wrote:

Hi Curt

try the following macro

Sub SortColsIndependently()
Dim i As Long, lc As Long
lc = Cells(1, Columns.Count).End(xlToLeft).Column
For i = 1 To lc
Columns(i).Sort Key1:=Cells(1, i), Order1:=xlAscending
Next i
End Sub

Copy the Code above
Alt+F11 to invoke the VB Editor
InsertModule
Paste code into white pane that appears
Alt+F11 to return to Excel

To use
Alt+F8 to bring up Macros
Highlight the macro name
Run

--
Regards
Roger Govier

"curtc." wrote in message
...
Is their a function or short macro that will sort columns by alpha but
will
do all columns on the sheet at the same time and independently of the data
in
the other columns?
Example:
A B C
1 fred john james
2 albert zack chris
3 bill curt mike

Updated:
A B C
1 albert curt chris
2 bill john james
3 fred zack mike

  #5   Report Post  
Junior Member
 
Posts: 1
Default

Thanks for the help, Roger. I have a slightly different question: Is there a way of doing the same thing with numerical data? What would have to be changed in the macro to allow this command to work on a datasheet with numbers (and is there a limit to the number of columns that can be independently sorted in this way?)

Quote:
Originally Posted by curtc.[_2_] View Post
Thanks Roger. It works great for sorting multi columns on the same sheet, but
yet independently. Curt

"Roger Govier" wrote:

Hi Curt

try the following macro

Sub SortColsIndependently()
Dim i As Long, lc As Long
lc = Cells(1, Columns.Count).End(xlToLeft).Column
For i = 1 To lc
Columns(i).Sort Key1:=Cells(1, i), Order1:=xlAscending
Next i
End Sub

Copy the Code above
Alt+F11 to invoke the VB Editor
InsertModule
Paste code into white pane that appears
Alt+F11 to return to Excel

To use
Alt+F8 to bring up Macros
Highlight the macro name
Run

--
Regards
Roger Govier

"curtc." wrote in message
...

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
Group adjacent columns independently Tigerxxx Excel Discussion (Misc queries) 3 February 21st 09 06:58 PM
Filtering columns independently Youssef B. Excel Discussion (Misc queries) 4 September 25th 08 09:39 PM
help with sorting text in columns to match other columns rkat Excel Discussion (Misc queries) 1 August 11th 06 03:42 AM
sorting two columns at the same time bullseye Excel Worksheet Functions 3 June 6th 06 05:18 PM
Sorting data rows independently guillemot Excel Discussion (Misc queries) 0 December 22nd 05 04:54 AM


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

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"