Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6099197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:14:43+00:00 2026-05-23T13:14:43+00:00

I want to order Column A based on the values of Column B. In

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:14:44+00:00Added an answer on May 23, 2026 at 1:14 pm

    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:

    ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("B1:B6"), _
        SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("Sheet1").Sort
        .SetRange Range("A1:B6")
        .Header = xlGuess
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    

    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:

    Range("A1:B6").Sort Key1:=Range("B1:B6"), Order1:=xlAscending
    

    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:

    Application.ScreenUpdating = False
    Range("A1:B6").Copy Destination:=Range("G1:H6")
    Range("G1:H6").Sort Key1:=Range("H1:H6"), Order1:=xlAscending
    Range("G1:G6").Copy Destination:=Range("A1:A6")
    Range("G1:H6").Clear
    Application.ScreenUpdating = True
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a VARCHAR2 column that I want to sort numerically. 99% (or possibly
I want to order grades that are a string in the following order. K,
I want to order by Time,but seems no way to do that ? mysql>
I want to order values from database query by date but I want also
...@Sort bit) AS SELECT .............. and I want to Order only if Sort =
I have a query that I want to sort alphabetically, but the trick is
I want to put a condtion to sort SQL data based on the value
I want to update the top 10 values of a column in table. I
I want to calculate some trends based on the values I get in my
I want to order by id asc, date asc, but in the case where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.