Power Query in Excel lets you clean, combine, and transform data from multiple sources without writing code. It automates repetitive data preparation tasks, reducing errors and saving hours each week. You need Excel 2016 or later (including Microsoft 365) with Power Query enabled by default.

What You'll Need

  • Microsoft Excel 2016 or later (including Microsoft 365)
  • A data source: CSV, Excel file, database, web page, or folder with multiple files
  • Basic familiarity with Excel tables and cell references

Step-by-Step

  1. Open Excel and load your first data source. Go to the Data tab, then click Get Data > From File > From CSV (or From Excel, From Web, etc.). Navigate to your file and select it, then click Load. This imports the data into a new worksheet.
  2. Once data loads, Power Query Editor opens automatically. If it doesn’t, select your data range in Excel, then go to Data > From Table/Range and confirm your data has headers.
  3. In Power Query Editor, click on a column header to select it. Use the Transform tab to change data types—click the icon below the column name and choose Text, Whole Number, Date, etc. Always ensure dates and numbers are correctly typed to avoid calculation errors later.
  4. To remove unwanted columns, right-click the column header and select Remove. To remove rows, select them, right-click, and choose Remove Rows > Remove Rows. Avoid deleting rows manually in Excel—do it in Power Query so the steps are recorded.
  5. Use the Remove Rows button on the Home tab to delete blank rows (Remove Blank Rows) or top/bottom rows (Remove Top Rows / Remove Bottom Rows). For example, if your data has 5 header rows, remove the top 5 rows.
  6. To split a column, select it, then click Split Column > By Delimiter. Choose the separator (comma, space, custom character), and pick whether to split into rows or columns. For example, split "Full Name" by space into First Name and Last Name columns.
  7. To merge columns, select multiple columns (hold Ctrl), right-click, and choose Merge Columns. Pick a delimiter like space or hyphen. This combines "City" and "State" into "City, State".
  8. Add custom columns using the Add Column tab. Click Custom Column, give it a name (e.g., "Total Cost"), and type a formula like [Quantity] * [Unit Price]. Use the formula bar to check syntax—Power Query uses M language, but simple math works with bracketed column names.
  9. Filter data by clicking the dropdown arrow in a column header. Uncheck items you want to exclude. Filters are dynamic: if your source data changes, the filter reapplies automatically when you refresh.
  10. Combine multiple files from a folder: Go to Data > Get Data > From File > From Folder. Select the folder containing your CSV or Excel files. Click Combine > Combine & Load. Power Query automatically detects and merges columns across files, even if they’re slightly misaligned.
  11. When your transformations are complete, click Close & Load. Data loads into Excel as a table. To update later, right-click the table and select Refresh, or go to Data > Refresh All.
  12. Save your workbook. Power Query steps are saved with the file. You can view them later by selecting any cell in the table, then going to Data > Queries & Connections to see the query name and edit steps.

Common Mistakes

  • Editing data directly in Excel after loading—it breaks the Power Query automation. Always adjust steps in Power Query Editor, then refresh.
  • Not checking data types before transformation. Text numbers won’t calculate. Always verify column icons (A for text, # for number, calendar for date).
  • Using inconsistent column names across source files when merging. Power Query matches by name, not position. Rename columns in source files or use Rename in Power Query before combining.
  • Forgetting to remove extra header rows from imported files. Many CSVs have multiple header lines. Use Remove Top Rows to clean them up.
  • Trying to use Power Query on protected sheets or encrypted files. Unprotect sheets and ensure files are accessible before importing.

Tips

  • Use the Applied Steps pane on the right to review or delete individual steps. Click the X next to a step to undo it without restarting.
  • For repetitive tasks, duplicate a query: right-click the query name in Queries & Connections > Duplicate. Edit the copy without affecting the original.
  • Name queries clearly: right-click the query name > Rename. Use names like "Sales_2024" or "Inventory_Cleaned" instead of Query1.
  • Use the Advanced Editor to review or edit M code if you need to tweak logic beyond the GUI—but don’t delete it unless you understand it.
  • For large datasets, use "Only Create Connection" instead of Load. This keeps data in the model without cluttering your worksheet. Use PivotTables to report from it.
  • Always test changes on a small sample first. Copy 10 rows of data to a new file, load it into Power Query, and verify steps work before applying to the full dataset.

Troubleshooting

  • If data doesn’t load, check your internet connection if pulling from a web source. Try opening the source file manually to confirm it’s not corrupted.
  • If you see "Expression.Error: We couldn't parse the input as a date", go back to the Transform tab and manually set the column type to Date. Reapply if needed.
  • If Refresh fails with "Access Denied", the file path may have changed. Go to Data > Queries & Connections, right-click the query > Properties > Source, and update the file path.
  • If columns disappear after refresh, check for renamed headers in the source file. Power Query relies on exact column names. Rename them back or use the "Use First Row as Headers" step.
  • If Power Query Editor won’t open, restart Excel. If the issue persists, go to File > Options > Add-ins, and ensure Microsoft Power Query for Excel is enabled under COM Add-ins.
  • If the dataset grows too slow, reduce the number of steps. Remove unnecessary transformations, especially custom columns with complex formulas. Use filters early to reduce data volume.

Frequently Asked Questions

Can I use Power Query in Excel Online?

No. Power Query is not available in Excel for the web. You need the desktop version of Excel 2016 or later.

Does Power Query work with Google Sheets?

Not directly. You can export Google Sheets data as CSV and import it into Excel using Power Query.

Can I automate refreshes without opening Excel?

Yes, if you save the file to OneDrive or SharePoint and set up a scheduled refresh in Power BI Service. Excel files themselves cannot auto-refresh without being open.

What’s the difference between Power Query and VBA?

Power Query uses a point-and-click interface and M language to transform data without coding. VBA requires writing scripts and is better for complex logic or user forms—but harder to maintain.

Why does my data format change after refresh?

This usually happens if the source data’s structure changes (e.g., new columns, missing headers). Reopen Power Query Editor, check Applied Steps, and fix the source step.

Can I share a workbook with Power Query queries with others?

Yes. As long as recipients have Excel 2016 or later and access to the same data sources (same file paths or network locations), the queries will work when they refresh.