Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

How to clean CSV data with Power Query in Excel

Import a CSV, fix date interpretation, review errors, standardize names and convert prices with an explicit exchange-rate parameter.

Table of Contents

Power Query records data-cleaning steps so you can repeat them when a CSV export changes. This walkthrough covers dates, inconsistent brand names and mixed-currency prices, with checks that help prevent accidental data loss.

The menu names below describe desktop Excel for Windows; available connectors and commands vary by version and platform. Keep the original CSV unchanged and work in a separate workbook.

1. Import the CSV and inspect its structure

Select Data > From Text/CSV, choose your file and check the preview's delimiter and file encoding. Select Transform Data to open the editor. If accented text appears garbled, fix the import encoding rather than replacing individual characters; our CSV encoding guide explains the issue.

Check column names and any automatically added Changed Type step. Keep identifiers with leading zeros as text. Review Applied Steps as you work so you know which transformation caused a problem.

2. Interpret dates using the source's locale

Right-click the Date column and select Change Type > Using Locale. Choose Date and the locale that matches the source: for example, month/day/year and day/month/year require different interpretations.

A single US locale does not reliably resolve a column containing mixed date conventions. An entry such as 03/04/2025 is ambiguous without source context. Separate sources or formats before conversion, and check known dates afterward. Converting to Date also discards the time component; it does not correct a 12-hour timezone difference.

How to Use Power Query to Clean Excel Data Picture 1

Microsoft's data-type guidance explains how locale affects interpretation, which is separate from how a date is displayed.

3. Investigate errors and missing values separately

Use Keep Errors on a diagnostic copy of the query to inspect failed conversions. Check the original value, column type and source format before deciding whether to fix, replace or exclude a row.

Remove Errors deletes entire rows with errors in the selected columns. It does not remove ordinary null values. Filter nulls separately only if missing values genuinely make those records unusable. Record how many rows you exclude and why; silently dropping incomplete records can distort analysis.

How to Use Power Query to Clean Excel Data Picture 2

4. Standardize brand names

Select the Brand column and use Transform > Format > Trim to remove leading and trailing spaces. Then use Replace Values for confirmed variations, such as changing a known misspelling of GIGABYTE to the agreed name.

For text replacements, review the advanced matching options so a short brand name is not replaced inside a different word. A mapping table is easier to maintain when many variants exist. Do not merge genuinely different brands merely because their names look similar.

How to Use Power Query to Clean Excel Data Picture 3How to Use Power Query to Clean Excel Data Picture 4

5. Convert currencies without losing their identity

Keep the original Price column and add a Currency column before removing currency symbols. Confirm currency from the export's documentation or reliable metadata: a store name alone may not establish the currency for every record.

Parse the numeric amount with the correct locale, including decimal and thousands separators. For repeatable conversion, create a numeric parameter named PHP_per_USD, document its source and applicable date, and ensure it is greater than zero. If Price is numeric and Currency contains verified currency codes, an Add Column > Custom Column expression can be:

if [Currency] = "PHP" then Number.Round([Price] / PHP_per_USD, 2)
else if [Currency] = "USD" then Number.Round([Price], 2)
else null

This uses the rate you supply; it does not retrieve a live exchange rate. Leave unsupported currencies unconverted for review. Keep the input amount, currency and rate alongside the result so the calculation is auditable.

How to Use Power Query to Clean Excel Data Picture 5

6. Load, validate and refresh

Review Applied Steps and test a few known records, including dates, blank values and each currency. Compare input and output row counts, explain exclusions and check that numeric columns have suitable types.

How to Use Power Query to Clean Excel Data Picture 6

Select Home > Close & Load, or Close & Load To to choose the destination, then save the workbook. On later imports, Refresh reruns the recorded transformations, provided the source location and expected columns still match.

For additional transformations, see our Power Query cleaning commands. Always review refresh errors and totals before using the output in a report.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.