I want to order Column A based on the values of Column B.
In Google Sheets that is simply: =SORT(A1:A100,B1:B100,TRUE)
How to do that in Excel?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To do it manually, you can highlight all the columns you want sorted, then click “Custom Sort…” under “Sort & Filter” in the “Home” tab. This brings up a dialog where you can tell it what column to sort by, add multiple sort levels, etc.
If you know how to do something manually in Excel and want to find out how to do it programmatically using VBA, you can simply record a macro of yourself doing it manually and then look at the source code it generates. I did this to sort columns A and B based on column B and pulled the relevant code from what was generated:
Note that the automatically generated code almost always has unnecessary bloat though. But, it’s a nice way to figure out what functions you might need to use or research more. In this case, you could trim it down to something like this:
If you only want to reorder the contents of column A without touching column B (even though you’re using it as the sort key), you probably need to make a temporary copy, sort it, and copy back only column A. This is because Excel’s Sort function requires the sort key to be in the range being sorted. So, it might look like this: