How to Filter To Remove Columns in Excel

Learn multiple Excel methods to filter to remove columns with step-by-step examples and practical applications.

excelformulaspreadsheettutorial
12 min read • Last updated: 7/2/2025

How to Filter To Remove Columns in Excel

Why This Task Matters in Excel

Business workbooks rarely stay small for long. Sales exports, HR reports, customer data dumps, and IoT logs can arrive with dozens—or even hundreds—of fields. Many of those fields are useful only to the system that produced them, not to the analyst who must turn that raw dump into insights. Deleting unwanted fields outright is risky: the export may refresh tomorrow with a new structure, or other stakeholders might still rely on the hidden data. A safer, more flexible strategy is to filter to remove columns—that is, create a dynamic or static view that displays only the fields you care about while preserving the underlying source.

Imagine a marketing analyst who receives a weekly customer‐engagement file containing 60 columns. The analyst only needs five: Customer ID, Signup Date, Last Purchase, Lifetime Value, and Region. By learning how to filter out the other 55 columns, the analyst can build clean dashboards, reduce errors, and simplify formulas. Finance teams pruning large general-ledger extracts, supply-chain specialists narrowing sensor feeds to just temperature and humidity columns, or data scientists preparing training sets all face the same challenge: remove the noise while keeping the core.

Excel shines here because it offers multiple levels of abstraction. On the simple end, you can hide columns or copy-paste the ones you want. For repeatable, no-code solutions you can turn to Power Query. If you have Microsoft 365 or Excel for the web, dynamic array functions like CHOOSECOLS, DROP, or FILTER allow you to build formulas that automatically remove columns when the source changes. Not knowing these techniques leads to bloated files, sluggish calculations, and manual rework every time the data refreshes. Mastering them, on the other hand, connects to broader skills such as building reusable templates, creating self-service BI models, and collaborating seamlessly with colleagues who may rely on different subsets of the same source.

Best Excel Approach

The optimal approach depends on your version of Excel and whether you need a one-off cleanup or a dynamic, refreshable solution.

For Microsoft 365 users, the CHOOSECOLS function is usually the most direct. It lets you specify exactly which column numbers to keep, in the order you prefer, and it automatically resizes whenever the source table grows or shrinks. If you must filter based on column headers rather than positions—for example, keep any column whose header contains \"Date\"—combine FILTER with MATCH and ISNUMBER. For users on older versions (Excel 2019 or earlier without dynamic arrays), the best option is Power Query because it stores the transform steps and can refresh with a single click.

Syntax for the simplest dynamic approach:

=CHOOSECOLS(SourceTable,1,3,5,8)
  • SourceTable – the entire dataset, ideally formatted as an Excel Table
  • 1,3,5,8 – the column indices you wish to keep (relative to SourceTable)

Alternative header-based approach:

=FILTER(SourceTable, ISNUMBER(MATCH(SourceHeaderRow, KeepList,0)))

Here SourceHeaderRow is typically INDEX(SourceTable,1,), and KeepList is a vertical range listing the headers you want. Only columns whose headers appear in KeepList survive.

When your Excel lacks dynamic arrays, Power Query’s UI lets you uncheck unwanted columns, rename steps, and load the cleaned result back into any sheet.

Parameters and Inputs

Before building a solution, confirm the following:

  • Source Range or Table: Works best when the data is formatted as an official Excel Table (Ctrl + T). Tables expand automatically when new rows or columns arrive, so formulas referencing them stay intact.

  • Column Identifiers
    – Position‐based methods (CHOOSECOLS, DROP) expect integers such as 2 or 7.
    – Header-based methods (FILTER + MATCH) expect text strings that must exactly match or partially match the column names.

  • Optional Lists and Arrays
    KeepList: a vertically oriented list of headers to retain.
    RemoveList: an inverse list you want excluded; you can wrap EXCEPT logic around it.

  • Data Types: All functions are indifferent to the data type inside columns, but Power Query allows validation rules such as numeric or date types.

  • Edge Cases:
    – Duplicate column names lead to the first matching column being kept.
    – Hidden or filtered rows do not affect column filtering; they remain intact.
    – Blank columns still occupy a position index, so include or skip them explicitly.

  • Validation: Build helper formulas like =COUNTA(SourceHeaderRow)=ExpectedColumns so you receive an early alert when the incoming file’s structure changes.

Step-by-Step Examples

Example 1: Basic Scenario—Keep the First, Third, and Sixth Columns

Suppose you have the dataset below in an Excel Table named SalesData.

ABCDEF
OrderIDSKURegionCostCouponUsedRevenue
101P-01West25No40
102P-02East30Yes45

The manager wants only OrderID, Region, and Revenue. Follow these steps:

  1. Click any cell in [A1:F1] and press Ctrl + T. Ensure \"My table has headers\" is checked; rename the table SalesData.
  2. Decide the columns to keep by position: OrderID is column 1, Region is column 3, Revenue is column 6.
  3. In a blank cell (say H2), enter:
=CHOOSECOLS(SalesData,1,3,6)
  1. Press Enter. Because CHOOSECOLS is a dynamic array function, Excel spills the result to the right and down. You now see three columns with headers OrderID, Region, Revenue.

Why it works: CHOOSECOLS extracts the requested indexes in the order supplied. If tomorrow a new column for \"ReturnReason\" appears as column 7, your formula is unaffected because your positions (1,3,6) are still correct. Troubleshooting: If the source becomes an ordinary range, wrap it inside =CHOOSECOLS(TOCOL(SalesData,2),…) or convert back to a table.

Variations:

  • To keep a contiguous range, use DROP: =DROP(SalesData,,2) removes the first two columns, leaving columns 3 through end.
  • To keep the first five columns only: =TAKE(SalesData,,5).

Example 2: Real-World Application—Building a Quarterly Finance Report

A finance team receives a CSV export named Ledger_Q1.csv every month-end containing 40 columns, but the quarterly board deck needs just eight: Date, GL Account, Cost Center, Debit, Credit, Net, Supplier, and Approval Status.

Data volume: 100,000 rows, reloaded monthly.

Steps:

  1. Import with Power Query
    a. Data ▶ Get Data ▶ From File ▶ From Text/CSV.
    b. Navigate to Ledger_Q1.csv, click Transform Data.
    c. In Power Query’s preview, shift-click columns you do not need (32 of them) and choose Remove Columns.
    d. Rename the step “Removed Other Columns” so future refresh logs are readable.
    e. Close & Load To ▶ Table ▶ Existing worksheet [A1].

  2. Refresh Strategy
    Next month, replace the CSV with the new file of the same name in the folder. Right-click the query result table and select Refresh—Power Query re-imports, reapplies the “Removed Other Columns” step, and updates only the eight needed fields.

  3. Link to PivotTables and Dashboards
    Build a PivotTable off the query result: Rows = GL Account, Columns = Quarter, Values = Net. Because the shape of the query output never changes, the PivotTable cache stays stable. A single click refreshes both the data and the visuals, saving hours each quarter.

Performance: Power Query stores steps as M-code, which is highly optimized. For 100,000 rows, column removal is essentially instantaneous, whereas manual deletion could easily cause accidental data loss. The query also keeps workbook size down because only the transformed result is stored, not the full raw CSV.

Integration: Schedule automatic refresh through Power Automate or, in Excel for Windows, set the query to refresh on open. Multiple analysts can duplicate the query in other files, all pointing to the same folder path, ensuring a single source of truth.

Example 3: Advanced Technique—Dynamic Column Removal by Header Keyword

Scenario: A data scientist receives IoT sensor logs with 200 columns, but she needs only those whose header contains “Temp” or “Humidity”. The file changes daily; new sensor types appear regularly.

  1. Prepare Helper List
    In [K2:K3], enter the keywords:
    K\2 = \"Temp\"
    K\3 = \"Humidity\"
    Name the range KeepList.

  2. Create Dynamic Array Formula
    Assume the data table is named SensorData. In a blank area:

    =LET(
        Headers,  INDEX(SensorData,1,),
        MatchPos, BYCOL(Headers, LAMBDA(h, --SUM(--ISNUMBER(SEARCH(KeepList, h)))>0)),
        FILTER(SensorData, 1, MatchPos)
    )
    

Explanation:

  • Headers captures the first row (header row) as an array.
  • BYCOL iterates over each header, checking if any keyword in KeepList appears inside it. The logical results become MatchPos, an array of TRUE/FALSE per column.
  • FILTER’s tricky third argument controls column behavior. Normally FILTER removes rows, but when the row argument is 1 (meaning keep all rows), you can supply a second array for columns. Any column with TRUE in MatchPos will remain.
  1. Performance Optimization
    Use LET to avoid recalculating the header row repeatedly, critical when 100 MB of sensor data changes every minute.

  2. Edge Cases

    • If no column matches, FILTER returns #CALC!; wrap with IFERROR to display a friendly message.
    • To exclude certain columns instead, invert the logic: replace MatchPos with =NOT(MatchPos).

Practical impact: The scientist can drop 150 + irrelevant columns automatically and feed the cleaned dataset into LINEST, regression add-ins, or Power BI without manual intervention. As new sensors are installed, any column whose header starts with “Temp_” is automatically pulled into the model without rewriting formulas.

Tips and Best Practices

  1. Use Excel Tables: Convert your source to a table so added columns automatically flow into your formulas without updating range references.
  2. Document Column Positions: In a sidebar, list index numbers and headers. This serves as living documentation and helps new team members audit the extraction logic.
  3. Combine with NAMED RANGES: Name your KeepList or RemoveList. Your formulas read like sentences—=FILTER(Data, KeepByHeader)—making maintenance easier.
  4. Cache Heavy Queries: If Power Query outputs millions of rows, load to the Data Model instead of worksheet cells to minimize file size and improve refresh times.
  5. Version Control Queries: For mission-critical workbooks, copy the M-code into a text file or OneNote so changes can be rolled back quickly.
  6. Validate Source Structure: Add a helper cell =IF(COUNTA(HeaderRow)<>ExpectedColumns,"Structure changed","OK") to alert you when the vendor adds or removes fields.

Common Mistakes to Avoid

  1. Hard-Coding Column Numbers: If your data source changes order, CHOOSECOLS may pull the wrong fields. Mitigation: switch to header-based matching or create a mapping table.
  2. Deleting Columns Permanently: Manual deletion breaks refresh workflows and can remove audit trails. Use Power Query or dynamic arrays so the raw data stays intact.
  3. Forgetting Table Conversion: Ranges do not auto-expand. If you reference [A1:Z500] but tomorrow’s dump has 800 rows, you will truncate data. Always use tables.
  4. Ignoring Duplicate Headers: FILTER + MATCH keeps only the first duplicate. If duplicates are possible, use Power Query’s “Unpivot Other Columns” trick to deduplicate before filtering.
  5. Overlooking Error Conditions: When FILTER returns #CALC! because no column matched, downstream charts break. Always wrap with IFERROR and provide fallbacks like 0-row tables.

Alternative Methods

MethodExcel VersionStrengthsTrade-Offs
CHOOSECOLSMicrosoft 365Direct, simple, reorder columns easilyRequires column positions; not in older Excel
FILTER + MATCHMicrosoft 365Header-based, flexible logicSlightly complex formula; fails in pre-365
DROP / TAKEMicrosoft 365Quick for trimming first or last N columnsCannot pick non-contiguous columns
Power Query2010+ w/ add-in, 2016+ built-inNo-code, refreshable, large data friendlyRequires refresh step; formulas cannot reference until loaded
Hide ColumnsAll versionsFast for ad-hoc, preserves underlying dataNot a data-cleaning method; formulas still “see” hidden data
VBA MacroAll desktop versionsFull automation, custom logicNeeds macro security, maintenance overhead

Choose CHOOSECOLS for quick prototypes, FILTER + MATCH when header logic is critical, and Power Query when dealing with large or multi-file workflows. Migrate by first duplicating results side-by-side, ensuring they match, then point dependents to the new method.

FAQ

When should I use this approach?

Use column filtering whenever the source file contains more fields than you need for reporting, analysis, or downstream system uploads. It shines in recurring workflows like weekly exports, but it is equally valuable for one-time cleanups where you want a reproducible record of what you removed.

Can this work across multiple sheets?

Yes. Dynamic array formulas can reference tables on other sheets as long as the workbook is open. Power Query can append multiple sheets or files into a single query, then apply the same column removal step globally.

What are the limitations?

Dynamic array functions are available only in Microsoft 365 or Excel for the web. Older versions must rely on Power Query or VBA. CHOOSECOLS cannot detect header names; if column order changes it may pull the wrong fields. Power Query transformations are workbook-specific unless you export the query as a template.

How do I handle errors?

Wrap dynamic formulas in IFERROR to intercept #CALC! or #REF!. In Power Query, use the “Keep errors” or “Remove errors” steps and insert conditional columns that flag anomalies (for example, unexpected text in numeric columns).

Does this work in older Excel versions?

Yes, but via alternative tools. Excel 2010/2013 with the free Power Query add-in, and Excel 2016 onwards with built-in Get & Transform, support the same column-removal steps. Dynamic array formulas like CHOOSECOLS or FILTER will simply return #NAME?.

What about performance with large datasets?

Power Query processes millions of rows efficiently because it uses a columnar engine. Keep the preview disabled when not needed and load only to the Data Model. For formulas, turn off calculation until the data finishes spilling, or split the workbook so heavy data resides in Power BI.

Conclusion

Learning to filter to remove columns transforms messy, oversized data dumps into lean, purpose-built datasets. Whether you reach for CHOOSECOLS, combine FILTER with header matching, or build a repeatable Power Query, the result is the same: faster analysis, lighter workbooks, and fewer errors. This skill dovetails neatly with data modeling, dashboard design, and automating refresh cycles. Experiment with the methods in a copy of your next raw export, document your chosen approach, and watch your Excel productivity soar.

We use tracking cookies to understand how you use the product and help us improve it. Please accept cookies to help us improve.