I know that data sorting is limited to 3 sorts in excel, but does that limitation exist in VBA. I need to sort on 5 columns, but I am not sure if that is possible?
![]() |
Patch reliability is unclear, but widespread attacks make patching prudent. Go ahead and patch, but watch out for potential problems. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Sorting limitations
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Sorting limitations
- This topic has 6 replies, 5 voices, and was last updated 15 years, 5 months ago.
AuthorTopicWSVegasNath
AskWoody LoungerNovember 28, 2009 at 1:16 pm #464145Viewing 1 reply threadAuthorReplies-
WSsdckapr
AskWoody LoungerNovember 28, 2009 at 1:58 pm #1187096If you want to use the built-in sort functions of XL while in VB you are limited to 3 sorts as well since they both use the same routines. If you want to create your own sorting functions you are not limited to the 3 criteria limit, but you must do all the “heavy lifting” by coding it and will be slower than the built-in routines.
Sorting by more than 3 columns can be done using the built-in features by doing multiple sort passes. First sort on the least important items then sort again on the more important items.
Steve
-
WSAndrewKKWalker
AskWoody LoungerNovember 28, 2009 at 2:25 pm #1187099If you want to use the built-in sort functions of XL while in VB you are limited to 3 sorts as well since they both use the same routines. If you want to create your own sorting functions you are not limited to the 3 criteria limit, but you must do all the “heavy lifting” by coding it and will be slower than the built-in routines.
Sorting by more than 3 columns can be done using the built-in features by doing multiple sort passes. First sort on the least important items then sort again on the more important items.
Steve
Just run it as 5 individual sorts in reverse order
Meaning..
If in the sort dialogue you would do Sort1, Sort2, Sort3 from top to bottom
then in code do Sort3, Sort2, Sort1
Hence for 5 Sort sequence do
Sort5, Sort4, Sort3, Sort2, Sort1
-
WSJezza
AskWoody LoungerNovember 28, 2009 at 2:59 pm #1187103 -
Don Wells
AskWoody LoungerNovember 28, 2009 at 4:26 pm #1187110A similar method is to use a concatanation of the Row Range similar to:
=A1 & B1 & C1 & D1 & E1
In column F1, this column can of course be hidden and will work only if it is all text.
Text conversion can be utililised such as :
=A1 & B1 & C1 & D1 & TEXT(E1,”yyyymmdd”)
Hi Jerry
I think there is a flaw in your logic. If for example column C consists of varying length text, column D will not be sorted properly.
-
WSJezza
AskWoody Lounger
-
-
-
-
-
WSVegasNath
AskWoody Lounger
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Red x next to folder on OneDrive iPadOS
by
dmt_3904
1 hour, 10 minutes ago -
Are manuals extinct?
by
Susan Bradley
52 minutes ago -
Canonical ditching Sudo for Rust Sudo -rs starting with Ubuntu
by
Alex5723
10 hours, 18 minutes ago -
Network Issue
by
Casey H
2 hours, 21 minutes ago -
Fedora Linux is now an official WSL distro
by
Alex5723
22 hours, 17 minutes ago -
May 2025 Office non-Security updates
by
PKCano
22 hours, 44 minutes ago -
Windows 10 filehistory including onedrive folder
by
Steve Bondy
1 day ago -
pages print on restart (Win 11 23H2)
by
cyraxote
1 hour, 32 minutes ago -
Windows 11 Insider Preview build 26200.5581 released to DEV
by
joep517
1 day, 2 hours ago -
Windows 11 Insider Preview build 26120.3950 (24H2) released to BETA
by
joep517
1 day, 2 hours ago -
Proton to drop prices after ruling against “Apple tax”
by
Cybertooth
1 day, 10 hours ago -
24H2 Installer – don’t see Option for non destructive install
by
JP
2 hours, 37 minutes ago -
Asking Again here (New User and Fast change only backups)
by
thymej
1 day, 21 hours ago -
How much I spent on the Mac mini
by
Will Fastie
21 hours ago -
How to get rid of Copilot in Microsoft 365
by
Lance Whitney
38 minutes ago -
Spring cleanup — 2025
by
Deanna McElveen
2 days, 3 hours ago -
Setting up Windows 11
by
Susan Bradley
22 hours, 30 minutes ago -
VLC Introduces Cutting-Edge AI Subtitling and Translation Capabilities
by
Alex5723
1 day, 22 hours ago -
Powershell version?
by
CWBillow
1 day, 23 hours ago -
SendTom Toys
by
CWBillow
10 hours, 38 minutes ago -
Add shortcut to taskbar?
by
CWBillow
2 days, 3 hours ago -
Sycophancy in GPT-4o: What happened
by
Alex5723
2 days, 20 hours ago -
How can I install Skype on Windows 7?
by
Help
2 days, 18 hours ago -
Logitech MK850 Keyboard issues
by
Rush2112
2 days, 1 hour ago -
We live in a simulation
by
Alex5723
3 days, 10 hours ago -
Netplwiz not working
by
RetiredGeek
2 days, 20 hours ago -
Windows 11 24H2 is broadly available
by
Alex5723
3 days, 22 hours ago -
Microsoft is killing Authenticator
by
Alex5723
1 day ago -
Downloads folder location
by
CWBillow
4 days, 5 hours ago -
Remove a User from Login screen
by
CWBillow
3 days ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.