How to Rearrange Columns in Excel to Match Another Sheet (4 Ways)

Here, we have taken an Excel workbook that contains multiple worksheets that contain the same dataset with different arrangements. The dataset contains the Names of students and their Percentage Number of different subjects.

4 Simple Ways to Rearrange Columns in Excel to Match Another Sheet


Method 1 – Using SHIFT and Drag to Rearrange Column to Match Another Sheet

We want to match the order of the columns from the sheet named “Drag & Drop Command” to the sheet named “Dataset.”

1. Using SHIFT and Drag to Rearrange Column to Match Another Sheet

Steps:

  • Select the column you want to move. I have selected the column named
  • Hold the SHIFT key and then drag the left or right border of the column.
  • Drop the column in the position you want. I have dropped the column after the column named Name.

1. Using SHIFT and Drag to Rearrange Column to Match Another Sheet

  • You can see that I have moved the Physics column successfully.

1. Using SHIFT and Drag to Rearrange Column to Match Another Sheet

  • Follow the same steps to move the column Chemistry.

1. Using SHIFT and Drag to Rearrange Column to Match Another Sheet

  • Move the column Biology to Column F to get your desired order as in the sheet “Dataset.”

1. Using SHIFT and Drag to Rearrange Column to Match Another Sheet

Here, you will get the rearranged column matches to another sheet.

1. Using SHIFT and Drag to Rearrange Column to Match Another Sheet

It should be noted that while you are using this method, there can not be any merged columns in the table. If there are any merged columns in the table, it will show an error and will not be able to perform the task successfully.


Method 2 – Using the Sort Command to Rearrange Column

We are matching the order of columns from sheet “Using Sort Command” to the order of the columns of sheet “Dataset2.”

2. Use of Data Sort to Rearrange Column

Steps:

  • Insert a new row above the table.
  • Right-click on the first row and then select Insert from the Context Menu. That will insert a new row at the top.

2. Use of Data Sort to Rearrange Column

  • Insert the new sorting order from your desired sheet. I have inserted the sorting order according to the order of the sheet “Dataset2.”

2. Use of Data Sort to Rearrange Column

  • Select the entire data table. Here, we selected the cell range B4:F13.
  • Go to the Data menu and then select Sort from Sort and Filter.

2. Use of Data Sort to Rearrange Column

  • You will see that the Sort Dialog box will open.
  • Click Options and mark on Sort left to right, and select Ok

2. Use of Data Sort to Rearrange Column

  • Back in the Sort dialog box, select the row where you have inserted the sorting order in the Sort by menu. I have selected Row 4.
  • Select Smallest to Largest in the order field.
  • Select OK. That will sort your columns according to the order.

2. Use of Data Sort to Rearrange Column

  • Select the Entire first row you inserted at the beginning then Delete.

2. Use of Data Sort to Rearrange Column

You can see that the column order of my “Using Sort Command” sheet matches exactly with the “Dataset2” sheet.

2. Use of Data Sort to Rearrange Column


Method 3 – Using the XLOOKUP Function to Rearrange Columns to Match Another Sheet

We want to match the column order of the sheet “XLOOKUP Function” with the column order of the sheet “Dataset3.”

3. Using XLOOKUP Function to Rearrange Columns to Match Another Sheet

Steps:

  • Insert the new column order in the sheet you want to rearrange the columns. I have inserted the column order from the “Dataset3” sheet into Row13 of the “XLOOKUP Function” sheet.

3. Using XLOOKUP Function to Rearrange Columns to Match Another Sheet

  • Select the cell from where you want to rearrange your data according to the column order. Here, I have selected cell B14.
  • Enter the following formula in cell B14:
=XLOOKUP($B$13:$F$13,$B$4:$F$4,XLOOKUP(B5,$B$5:$B$9,$B$5:$F$9))

3. Using XLOOKUP Function to Rearrange Columns to Match Another Sheet

Here, in the XLOOKUP function, I selected cell range B13:F13 as lookup_value and B4:F4 as lookup_array. Next, I used another XLOOKUP function as a return_array, where I selected cell B5 as lookup_value, B5:B9 as lookup_array, and B5:F9 as return_array.
I used absolute cell reference so that the selected range remain the same while using the AutoFill.

Now, the XLOOKUP function will give you the results for the B5 cell from the return_array.

  • Press ENTER and you will see that the data are rearranged according to the new order.

3. Using XLOOKUP Function to Rearrange Columns to Match Another Sheet

  • Use the Fill Handle tool to Auto-fill the formula for the rest of the cells.

3. Using XLOOKUP Function to Rearrange Columns to Match Another Sheet

  • Now you will see that all the data are sorted according to the new order.

3. Using XLOOKUP Function to Rearrange Columns to Match Another Sheet

  • We have our desired table according to the order of the sheet named “Dataset3”.

3. Using XLOOKUP Function to Rearrange Columns to Match Another Sheet


Method 4 – Using the MATCH Function to Rearrange Column Values

We want to rearrange the order of the Name column from the sheet “MATCH Function” to match the order of the name column of the sheet “Dataset”. 

4. Using MATCH Function to Rearrange Column Values

Steps:

  • Insert a new column in your sheet.

4. Using MATCH Function to Rearrange Column Values

  • Enter the following formula in cell B5:
=MATCH(C5,Dataset!$B$5:$B$12,FALSE)

4. Using MATCH Function to Rearrange Column Values

Here, in the MATCH function, I have selected C5 as lookup_value, selected cell range Dataset!$B$5:$B$12 as lookup_array from the Dataset sheet, and also selected FALSE as match_type. Now, this will return the order in which it matches the lookup_array.

  • Press ENTER, and you will get the new sort order for the row.

 Using MATCH Function to Rearrange Column Values

  • Use the Fill Handle tool to Auto-fill the formula for the rest of the cells.

 Using MATCH Function to Rearrange Column Values

  • You will get the Sorting order for the whole table.

 Using MATCH Function to Rearrange Column Values

You will have to sort the rows using the Sort command.

  • Select the range. Here, I selected the range B4:F12.
  • Go to the Data tab >> select Sort from Sort & Filter.

 Using MATCH Function to Rearrange Column Values

The Sort dialog box will appear.

  • In that Sort dialog box, click on Options and click on Sort top to bottom.
  • Select OK.

 Using MATCH Function to Rearrange Column Values

  • Back in the Sort dialog box, select the column in which you have inserted the sorting order in the Sort by menu. Here I have chosen the Helper Column.
  • Select Smallest to Largest in the Order menu.
  • Select OK. That will sort your rows according to the order.

 Using MATCH Function to Rearrange Column Values

  • You can delete the Helper Column and get your exact rearranged columns.

 Using MATCH Function to Rearrange Column Values

Here, you can see that all the columns in sheet “MATCH function” are rearranged according to the columns in sheet “Dataset”.

 Using MATCH Function to Rearrange Column Values

Read More: How to Rearrange Columns in Excel


Things to Remember

  • While using the Sort command, you must insert the column order carefully; otherwise, you will get the wrong column arrangement.
  • For the drag-and-drop method, there can not be merged cells. If you have any, it will give you an error.

Practice Section

Here is a practice sheet for you to practice different methods on how to rearrange columns in Excel.

Practice Section


Download the Practice Workbook


Related Articles


<< Go Back to Rearranging in ExcelData Analysis with Excel Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Mashhura Jahan
Mashhura Jahan

Mashhura Jahan, BSc in Industrial and Production Engineering from Bangladesh University of Engineering and Technology, invested 1.5 years at ExcelDemy. In roles like Excel & VBA Content Developer, Excel Charts, and Dashboard course trainer, she wrote 90+ articles. She was previously part of the forum support team and a junior software analyst on the Excel Add-in project. With interests spanning Excel, VBA, Power Query, Python, Data Science, and Software Development, Mashhura brings a diverse skill set to her... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo