To keep only certain columns in Excel Power Query, open the query, select the columns you want, then choose Home > Remove Columns > Remove Other Columns. Power Query removes the unselected columns from the query result and records the change as a step, so the same selection is applied again when the query refreshes.
What “Keep Columns” Means in Power Query
Power Query is Excel’s tool for connecting to data, cleaning it, and loading the result into a worksheet or data model. A query can contain many steps, such as changing data types, filtering rows, splitting text, and removing fields. “Keep columns” means limiting the output at a particular step to a chosen set of fields. It does not delete those fields from the original workbook, file, database, or other source.
For example, imagine a monthly sales export with 18 fields: Order ID, Date, Customer, Region, Product, Quantity, Unit Price, Sales Rep, and several internal codes. If a report needs only Date, Region, and Quantity, keeping those three columns makes the query output narrower and easier to work with. The source file remains unchanged; Power Query simply returns a transformed table containing the columns you selected.
This operation is different from hiding columns in an Excel worksheet. A hidden worksheet column is still part of the table and may still be loaded by a query. Keeping columns changes the query’s result itself.
Keep Only Selected Columns in Excel for Microsoft 365
These steps apply to Excel for Microsoft 365 on Windows. If the query already exists, open it from the Queries & Connections pane. If you are starting from a worksheet table, select a cell in the table and use Data > From Table/Range to open the Power Query Editor.
- In the Power Query Editor, click a column header to select one column.
- To select several non-adjacent columns, hold Ctrl while clicking each additional header. To select a continuous range, click the first header, hold Shift, and click the last header.
- On the Home tab, choose Remove Columns > Remove Other Columns. You can also right-click a selected header and choose Remove Other Columns.
- Check the preview to confirm that only the desired fields remain. Then select Home > Close & Load, or use Close & Load To if you want to choose where the result goes.
For an existing query, open Data > Queries & Connections, then double-click the query or right-click it and choose Edit. The exact pane layout can vary with the Excel window and build, but the query opens in the Power Query Editor. On Mac, Power Query is available in supported Microsoft 365 versions, although connectors and some editing or refresh options can differ from Windows. Excel for the web has more limited query-editing capabilities, so use the desktop editor if the command is unavailable.
Use Choose Columns Instead
There is another useful route when you know the names of the fields you need but do not want to select them one by one in the preview. In the Power Query Editor, choose Home > Choose Columns. In the dialog, select the columns to include and confirm. This is especially convenient for wide tables, where the fields you need may be far apart or difficult to locate by scrolling.
Use the column-header selection method when it is easy to see the fields in the preview or when you want to keep a small, visible group. Use Choose Columns when you want to review a longer list of names in one place. Both approaches create a query step that restricts the output columns; neither edits the original source data.
After keeping columns, you can change their order separately. Drag headers in the preview or use the column-ordering commands available in the editor. Keeping columns is about which fields remain, not necessarily the order in which your report should present them.
What Power Query Adds to the Query
Power Query stores transformations as steps. When you choose Remove Other Columns, the editor commonly creates a step based on the M language function Table.SelectColumns. For example, if the previous step is named Source and the desired fields are Date, Region, and Sales, the step can look like this:
Table.SelectColumns(Source, {"Date", "Region", "Sales"})
The first argument is the table produced by the preceding step. The list in braces names the fields to retain. If the previous step has a name containing spaces, Power Query uses a quoted identifier such as #"Changed Type" in place of Source. The editor writes the code for you; most users do not need to edit M manually.
This step is visible in the Applied Steps list, usually with a name such as Removed Other Columns. Selecting it lets you see the table at that point in the query. You can remove or adjust a step, but pay attention to later steps: a later formula that refers to a removed field may fail because that field is no longer present.
By default, Table.SelectColumns expects the named columns to exist. If a source changes and one of those fields disappears or is renamed, refresh can produce an error. M also supports an optional missing-field behavior, but it should be chosen deliberately: substituting a null column may keep the query running while concealing a meaningful change in the source.
Keep Columns or Remove Columns?
These commands solve opposite versions of the same problem. Remove Other Columns is usually the clearer choice when you want a small subset from a large table. Select the useful fields and discard the rest from the query result. Remove Columns is more direct when you want to discard only a few known fields and retain everything else.
- Keep three out of twenty columns: select the three and use Remove Other Columns.
- Remove one temporary notes field out of twenty: select that field and use Remove Columns.
- Keep a known list by name: use Choose Columns to select the intended fields from a list.
There is a practical difference when new fields appear in the source after a refresh. A keep-columns step continues to return its explicitly listed fields; a remove-columns step generally leaves other fields in place, including new ones, unless another step changes them. This makes “keep” a useful way to create a controlled output schema, while “remove” can be more flexible when you want to preserve most of an evolving source.
How the Selection Behaves on Refresh
A saved keep-columns step is applied each time the query refreshes. Suppose this month’s source has Date, Region, and Sales, plus an extra Notes field. If the query is set to keep Date, Region, and Sales, Notes will not appear in the loaded result. This is often desirable when a report should have a stable set of fields, even if the source export gradually adds columns.
The reverse case needs attention. If a kept column is renamed or removed from the source, the query may report an error at the keep-columns step or at a later step that refers to it. A similarly named replacement is not automatically guaranteed to be treated as the original field. Check the source headers and the Applied Steps list, then update the selection and any dependent steps if the schema has intentionally changed.
Keep columns also affects only the point in the transformation sequence where the step appears and the steps after it. Earlier steps may still use columns that are later removed. That can be useful—for instance, you can calculate a category from a detailed field and then remove the detailed field from the final output. But removing a field too early can prevent later filters, calculations, or merges from using it.
Common Problems and How to Fix Them
- The wrong columns remain: check which headers were selected before choosing Remove Other Columns. The command retains the selected fields, not the ones that were unselected. Undo the step or edit the selection if necessary.
- A later step shows an error: inspect steps below the keep-columns step. A formula, sort, grouping, or merge may still refer to a field that was removed. Move the keep step later, or include the required field and remove it after its final use.
- Refresh fails after a source change: verify whether a selected header was renamed, deleted, or changed in spelling. Update the query’s selection and then review subsequent steps for the old name.
- New source columns do not appear: that is normally expected when the query explicitly keeps a fixed set. Edit the keep-columns step to include the new field if it belongs in the output.
- A column seems present despite being hidden in Excel: hiding a worksheet column does not remove it from Power Query. Use the editor’s column commands to change the query result.
One common misconception is that keeping fewer columns always changes the original file or database. It does not. It changes what the query produces and loads. The source is altered only if you separately edit that source or use another process that writes changes back to it.
Why Keep Columns Before Loading?
Removing unneeded fields can make a final table easier to inspect, export, and use in PivotTables or formulas. A narrower result also reduces the amount of data Excel has to load into the destination compared with loading every source field. The size of any performance improvement depends on the source, the number and type of columns, and the rest of the query; keeping columns is not a guarantee of a faster refresh.
In some workflows, removing irrelevant columns early can also simplify later transformations. However, “early” should not mean before a field has served its purpose. For instance, a customer ID may be necessary for a merge even if the finished report does not display it. Keep it through the merge, then remove it in a later step if it is not part of the intended output.
A practical rule is to decide what the loaded table needs, then check whether any earlier query steps depend on additional fields. Keep the minimum set needed for the remaining transformations, and remove helper fields only after their last use. This balances a clean output with a refreshable query.
Frequently Asked Questions
How do I keep only certain columns in Power Query?
In the Power Query Editor, select the desired headers and choose Home > Remove Columns > Remove Other Columns. Alternatively, use Home > Choose Columns to select fields from a list.
Does Remove Other Columns delete data from my source file?
No. It removes unselected columns from the query’s transformed output, not from the original workbook, CSV, database, or other source.
Will newly added source columns appear after refresh?
Not if the query has a step that keeps a fixed list of fields. Edit that step to include a new field if you want it in the loaded result.
Why does my query fail after I keep columns?
A selected field may have been renamed or removed from the source, or a later step may refer to a field that was not kept. Check the refresh error and review the Applied Steps in order.
Can I keep columns in a particular order?
Yes. After choosing which columns to retain, reorder them in the Power Query Editor. Column selection and display order are separate tasks.
Is keeping columns the same as hiding columns in Excel?
No. Hiding changes how a worksheet displays columns; keeping columns changes which columns Power Query returns in its result.
Related
- Excel Named Range Shortcut: Create, Edit, and Use Names
- Excel Page Break Dotted Lines: How to Move Them in Print
- Excel Merge Cells and Keep All Text Without Data Loss
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- How to Screen Record a PowerPoint Presentation with AudioTo record a PowerPoint presentation with narration, open the deck and choose Record > From Beginning in PowerPoint…
- How to Insert a Checkbox in Word for Forms and ListsTo insert a clickable checkbox in a Word document, turn on the Developer tab, then choose Developer >…
- Google Sheets Filter Not Blank? Steps and FormulasTo show only rows with a nonblank cell in Google Sheets, select your table and choose Data >…
- How to Insert a Dynamic Checkbox in Microsoft WordTo insert a dynamic, clickable checkbox in Word, show the Developer tab, then choose Developer > Check Box…
- Multi-Level Dropdown List in Excel: How to Create OneTo create a multi-level dropdown list in Excel for Microsoft 365 on Windows, put each level’s choices in…
- Excel Keyboard Shortcut to Insert a Row or LineIn Excel for Microsoft 365 on Windows, select a row and press Ctrl+Shift+= to insert a worksheet row…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.