5 Ways to Move a Column in Google Sheets

This post is going to show you all the ways you can use to move and rearrange the columns in your Google Sheets workbooks. Most of these methods will also work for moving any rows around as well!

Google Sheets offers so many easy customizations for its users. The Google Sheets columns are no different as you can customize and move the columns to any new location.

While working with data tables, it is sometimes convenient to move columns from their original positions for better organization.

Ordering columns can help users better understand the data set.

In this article, you will be introduced to several different methods to get this done proficiently. What are you waiting for? Let’s MOVE! 😉

Use the above link to get your copy of the example workbook.

Move a Column with Drag and Drop

The first and foremost easiest method to move columns in Google Sheets is dragging it over and dropping it above another column.

This method doesn’t require any formula or any menu command. Just simple drag and drop, that’s it!

Suppose you have the Last Names in column A and First Names in B, as shown in the screenshot above. You wish to move the First Name ahead of the Last Name and make it column A.

Select column B by either clicking on the header bar at the top or by using the keyboard shortcut key combination Ctrl + Space + Space. You have to press the Spacebar twice.

As soon as you select the column, the mouse cursor will become a hand symbol.

Hold the left mouse key or hold the fingers on the left side of your laptop touchpad. The hand symbol is now converged into a fist symbol like the cursor is holding column B.

Holding the left-key, move the mouse and eventually column B to the position of column A. Bingo!

You will see that the First Name is moved ahead of the Last Name and promoted as column A now.

This is the easiest way of moving columns and swapping their places as it doesn’t use any formula or command to do the swapping. The next method will be more authentic and use one of the menus available to move the columns.

Note: You can also select multiple columns and move them across the Sheets provided they are consecutive. Hold the Shift key to select multiple columns.

Move a Column with the Edit Menu Move Option

If you want to move your columns to either the left or right in Google Sheets, then the Edit menu Move option is the right way to do it.

You can move the column to either the left or right with two dedicated options available for this operation.

The method has its own benefits as you don’t need to follow the potentially tricky way to click and drag on a laptop touchpad if you don’t have a mouse.

This method, you will do it a bit differently.

Select the column you want to move by clicking on the heading or using the Ctrl + Spacebar 2 shortcut.

  1. Go to the Edit menu.
  2. Select the Move option. You can see the Row up, Row down, Column left, and Column right options.
  3. Select either the left or right option to move the column to its new location.

Note: This method can also be used when you select multiple columns.

Move a Column with Cut and Paste

If you are working with a relatively small number of columns, the previous two methods are the ideal ones to move or swap columns.

However, if you have a large table where the data spans across many columns and rows, they can be a bit tedious and slow the process down.

The cut and paste method may be easier for these situations.

Select column B containing the First Name and then use the right mouse click to access all the available options for that column.

Select the first option to Cut this column. You can also do this operation with the keyboard shortcut Ctrl + X.

Select column A. Right-click and choose the Insert 1 column left option to add a blank column on the left of column A. This blank column will hold the value for the column that you cut and want to paste.

In the blank column added, right-click again and choose the Paste option to paste the column that you cut previously. You can also use the keyboard shortcut Ctrl + V to get this done.

You can now see that the First Name is promoted as column A and the Last Name is after that.

Move Column with the QUERY Function

The methods discussed until now will affect the original layout of the data.

This means you change the data source when swapping columns.

But what if you want to have a comparative look between the old and new structures simultaneously? The previous methods will not give you that liberty.

The QUERY function can be used to create a new copy of your dataset with the rearranged columns.

The function can be used at any cell location, including on a different sheet.

It will use the original data as a source, and then the SELECT clause allows you to choose the layout for the columns.

If you want to know more about the QUERY function, then check out our definitive guide to the QUERY function.

= QUERY ( A1:B, "SELECT B, A" )

Insert the above QUERY function. It uses the range A1:B as the data argument. This way any new data added below will also be returned by the QUERY function.

The function then returns the query results based on the second argument "SELECT B, A" as a query within the function.

This formula swaps the positions of columns A and B when the query is executed from the function.

It is the same as using the SQL SELECT statement to select the data. The columns are returned based on the order they appear in the SELECT statement.

Note: The best part about this function is that it allows you to keep the original column positions or table layouts and returns a new dataset as the output.

If you have multiple columns in your table, you can easily switch the column order in the SELECT clause.

Move Columns with Apps Scripts

Google Apps Script is an amazing tool available inside Google Sheets.

It allows you to write code that can automate almost anything with the click of a Run button.

If you are new to Google Apps Scripts then check out our in-depth beginner’s guide to apps scripts.

To access the Apps Script, go to the Extensions menu and click on the Apps Script option. It will launch the Apps Script editor in a new browser tab.

Use the following inside the Apps Script environment to swap the columns automatically. You can copy and paste this code into the Script editor.

function moveColumn() {
  sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Example");
  range = sheet.getRange("A1:A");
  sheet.moveColumns(range, 3); 
}

Explanation

  1. The first line of code defines a function with name moveColumn(). You can name it whatever you want but adding an short and descriptitve name is always a good practice.
  2. Then you use the SpreadsheetApp method to access the active spreadsheet and getSheetByName() method to access the specific worksheet with name Example. Results are stored into the sheet variable.
  3. The range variable calls the getRange() method on sheet to access the entire column A.
  4. The moveColumns() function takes the range defined on previous line and uses it to reposition column A at the third index. This will move column A to the right.

Hit the Run button to execute this script and see the results where the Last Name is swapped with the First Name.

Conclusions

Throughout this article, you have learned many methods to swap or move the columns from one position to another in Google Sheets.

The first method of dragging and dropping columns is quick to get the task done. However, it can sometimes be tedious to do through your laptops and hence not preferred by some users.

The Edit menu provides a Move option that allows you to move the column to the left or the right. This is a straightforward method to get the task done.

The third method is something you might prefer over previous methods when you have a relatively large dataset and don’t want to accidentally swap the wrong columns.

The QUERY function provides a SQL-like experience to swap the column with the added benefit of leaving the original dataset unchanged.

Using Apps Scripts can allow you to automate the process of moving columns should you want to include this action during some complex automation process.

If you know any other method to swap columns apart the ones discussed here, then let me know in the comment section below! 😊

About the Author

Lalit Salunkhe

Lalit Salunkhe

Lalit is a data analyst with diverse skills and experience in data mining and analysis. He has a M.Sc. in Statistics from one of the top institutes in Maharashtra. Lalit is also a Google Sheets expert and enjoys teaching others how to use Google Sheets to solve their data problems.

Related Articles

Comments

0 Comments

Get the Latest Google Sheets Tips

Write For Us

Are you a tech enthusiast with a talent for writing great content? Come write for us!

Follow Us

Follow us on social media to stay up to date with the latest in Google Sheets!