Sort multiple columns with numbers

falcios

Active Member
Joined
Aug 30, 2006
Messages
279
Office Version
  1. 2019
Platform
  1. Windows
Is there a way to select and sort all the numbers at one time? Right now I have to manually sort each column.

I inserted a table but that didn't work.

Any idea how I can select and sort all the data?

Thanks in advance.
 

Attachments

  • Excel Help Sort.jpg
    Excel Help Sort.jpg
    29.1 KB · Views: 11

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
if you are using office 365, you could use SORTBY function to sort your data dynamically without manual intervention.

My data is highlighted in yellow.

I enter the headings and then use the following formula to sort By Sales (largest to smallest - 1) and then Costs


=SORTBY(A2:C12,B2:B12,-1,C2:C12,-1)


1623821078299.png


Kind regards

Saba
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

I also suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with. ;)

From your description, you are wanting to sort every column individually. If that is so, then I would suggest a macro. This should sort each column, starting from column B. Test with a copy of your workbook.

VBA Code:
Sub Sort_Columns()
  Dim col As Long
  
  Application.ScreenUpdating = False
  For col = 2 To Cells(1, Columns.Count).End(xlToLeft).Column
    Columns(col).Sort Key1:=Cells(2, col), Order1:=xlAscending, Header:=xlYes
  Next col
  Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,861
Messages
6,121,973
Members
449,059
Latest member
oculus

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