Skip to main content

How to quickly sort rows to match another column in Excel?

doc sort match to another column 1
If you have two lists in a sheet, and both of them have same values but in different order, how can you sort one list to match another list as below screenshot shown? In this article, I will introduce a formula to help you quickly solve it in Excel.
Sort rows to match another column

arrow blue right bubble Sort rows to match another column

To sort rows to match another column, here is a formula can help you.

1. Select a blank cell next to the column you want to resort, for instance B1, and then enter this formula =MATCH(A1,C:C,FALSE), and drag autofill handle down to apply this formula. See screenshot:
doc sort match to another column 2

Tip: C:C is the column you want to resort based on, and A1 is the first cell of the column you want to sort.

2. And then a list of numbers are displaying in the formula cells. Select the list you want to resort and the numbers list, and click Data > Sort. See screenshot:
doc sort match to another column 3

3. And in the Sort dialog, select the column which contains the formulas from Column drop down list, and select Values and Smallest to Largest from the Sort On and Order drop down lists separately. See screenshot:
doc sort match to another column 4

4. Click OK. And the column A is sorted to match column C.
doc sort match to another column 5

Tip: You can delete the formula column after sorting if you do not need it any more.


Quickly Sort or select cells/Rows/Columns randomly from a selection in Excel

Kutools for Excel's Sort Range Randomly can quickly sort or select data randomly by cells or columns or rows. Click for full-featured 30 days free trial!
doc sort randomly
doc select randomly
 
 Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days.

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions…
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

Comments (25)
Rated 4.25 out of 5 · 2 ratings
This comment was minimized by the moderator on the site
Gracias, me ahorraste horas de trabajo y aprendí algo nuevo.
Rated 5 out of 5
This comment was minimized by the moderator on the site
Sorting data in rows to match respective column headers in excel.

A B C D E
---------
D
A C
C E
B D E
E
What I want it to look like:

A B C D E
---------
D
A C
C E
B D E
E
This comment was minimized by the moderator on the site
What it looks like:

A B C D E
---------
D
A C
C E
B D E
E
What I want it to look like:

A B C D E
---------
D
A C
C E
B D E
E

can we do this in Excel?
Rated 3.5 out of 5
This comment was minimized by the moderator on the site
Annn the formatting for that comment broke.

It would re-order it to:
0230
...........0231
...........0234
0236 0236
...........0240
0241
............0245
0250 0250
............0251

Is what I meant by insert empty cells as needed in each column
This comment was minimized by the moderator on the site
A lot of people are asking this question (on a 4 year old post) but I haven't found an answer.

I have 4 unique columns of time stamps from 4 sources. Not all the time stamps match up. I might have 0230, 0236, 0241, 0250 in one column and 0231, 0234, 0236, 0240, 0245, 0250, 0251 in another column. Is there away to have excel match the columns and insert empty cells as needed?
So instead of:
0230 0231
0236 0234
0241 0236 etc

It would re-order it to:
0230
0231
0234
0236 0236
0240
0241
0245
0250 0250
0251

I have about 13,000 rows I need to do this to across 4 columns so adding by hand or inserting rows is not feasible.
This comment was minimized by the moderator on the site
Hi, JOAT, you can use this formula:

=IFERROR(VLOOKUP(G1,$I$1:$I$8,1,FALSE)
See screenshot:
https://www.extendoffice.com/images/stories/comments/sun-comment/doc-lookup-formula-1.png
This comment was minimized by the moderator on the site
Hi, Great article!
I am wondering. If in the example above, column A does not have the value G2, this means that the sorting operation will be out of sync; 1,3,4,5,6,7,8. (missing a match for G2 on row index 2). Assuming that we want the rest of the data to line up, how can we resolve this without manually changing each line?
Is it possible to displace column A and use column B as a row index instead?
This comment was minimized by the moderator on the site
1 52 63 14 2 HOW CAN above two column data sort same data in one row
This comment was minimized by the moderator on the site
It doesn't help if the info is not exactly the same in both columns eg. column 1 has C,D,B, A and column 2 has B,D,C,A,G,R,T,H. When sorting column A to match column B, they won't match up. Any solution for this?
This comment was minimized by the moderator on the site
Sorry, the method only work while two columns have same numuber rows and same data but in different order.
This comment was minimized by the moderator on the site
Please share some way to sort if the info is not exactly the same in both columns eg. column 1 has C,D,B, A and column 2 has B,D,C,A,G,R,T,H.
This comment was minimized by the moderator on the site
Hey Sujith,

Did you find a solution because I have this exact problem. Please help
This comment was minimized by the moderator on the site
Daniella/Sujith,
How would the unique members of the resorted column be ordered? If they are numeric or alpha entries, then the ordering is simple; otherwise, it is less intuitive. May be easiest to isolate the 1-1 matching rows between the ref column and subject column, apply the ordering approach detailed above on that subset, then utilize a custom sort on the entire column as a final step. All of this is highly dependent on what type of data you have and ordering you expect to achieve.
-MH
This comment was minimized by the moderator on the site
Thanks a lot for this post.. made my work a lot easier :)
This comment was minimized by the moderator on the site
Anyone can help how to sort like below:

Column A is having and column B is having

1 1

1 2

2 1

2 2

But I need both column as


1

1

2

2
This comment was minimized by the moderator on the site
I do not understand your problem, can you give me more details?
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations