How to Use Power Query to Clean Excel Data

People have always used Excel for quick calculations and creating simple tables. But beyond common formulas and basic data manipulation techniques, you may never feel the need to learn more Excel functions—until projects start to get complicated.

 

How to Use Power Query to Clean Up Data

Many people have decided to follow a simple step-by-step process in Power Query Editor. This is exactly how they clean up those messy CSV exports and turn them into a consistent, well-structured spreadsheet.

First, import the data into Power Query Editor by opening a blank workbook, clicking Data on the ribbon, and selecting From Text/CSV . Then, select the CSV file and click Transform Data to open the file in Power Query Editor.

 

Start by fixing the Date column . Since the example is collecting data from two sources with timestamps 12 hours apart, the author needs to standardize the dates. This turns out to be incredibly simple. Just select the Date column , right-click to open the context menu, and select Change Type > Using Locale . In the pop-up menu, set the type to Date and select English (United States) to ensure consistent formatting. Power Query then automatically recognizes different formats, such as MM/DD/YYYY, YYYY/MM/DD, and variations that use notations like DD-MM-YY, and normalizes them all to a single date format.

How to Use Power Query to Clean Excel Data Picture 1

 

Now that the date format is fixed, all that needs to be done is clean up the column. There are a number of ways to clean up an Excel spreadsheet, but since all errors are erroneous entries made by the data collection tool, simply select the Remove Errors filter to remove those entries. This will remove any null values ​​and any remaining problematic data that wasn't recorded correctly, leaving you with clean, consistent dates across all your files.

How to Use Power Query to Clean Excel Data Picture 2

 

Next, we need to resolve the brand name confusion using the Replace Values ​​function . As before, select the target column, then right-click to open the context menu and select Replace Values . In the pop-up window, enter the inconsistent value in the Value to Find field and the standard value in the Replace With field .

Do this about two more times and finally got all the "gigabyte" and "GIGABTYE Inc." values ​​to a single "GIGABYTE" value across all files. Do the same for AMD and now the entire Brand column for the GPU uses the standard brand name.

 

Finally, we need to normalize the Price column . This is a bit tricky because many of the entries are just numbers, with no indication of whether they are in US dollars or Philippine pesos, making conversion difficult. Luckily, the Store column is right next to it, allowing us to easily convert all of our Shoppe PH prices to USD.

The way to fix this is to first use Replace Values ​​to remove all $, ₱, USD, and PHP from the Price column. Then, convert the values ​​to decimals using Change Type > Decimal . With a clean column containing only decimals, create a new column by clicking Column (ribbon) > Custom Column and name it "Price USD". Then, enter the following formula:

if [Store] = "Shopee PH" then Number.Round([Price] / 55, 2) else Number.Round([Price], 2)

Then press OK . This will convert all prices from Shopee PH to USD for easy comparison.

How to Use Power Query to Clean Excel Data Picture 5

 

Formulas are written in the Power Query M formula language. It is a fairly simple scripting language with simple core concepts that are easy to grasp. You don't need to learn the entire language to use it effectively. Many people just use it as a reference whenever they need to build their own formulas.

How to Use Power Query to Clean Excel Data Picture 6

Now that everything is in place, just close the Power Query Editor and select Keep to save all the changes in the created workbook.

Power Query will save hours of time

One reason many people avoid using Power Query is because they think it will be a complicated feature that will take too long to learn. But it turns out it's a lot easier than it sounds. Instead of running countless find and replace commands, you can use Power Query to quickly and automatically clean up data from your data collection tools.

What's even more amazing about Power Query is that every command executed is logged and can be repeated multiple times. This essentially gives you an automated cleanup script that can transform messy CSV files into clean, structured spreadsheets—perfect if you're creating custom datasets using web crawlers, as those tools often output messy data.

For anyone dealing with repetitive data cleanup, inconsistent formatting, or multiple data sources, Power Query turns those burdens into a simple, automated process. Instead of spending hours each week manually fixing errors, you can simply hit Refresh and start analyzing. It's an Excel feature that many people wish they had long ago. Once you experience the power of an automated, reproducible cleanup script, you won't want to go back.

4 ★ | 1 Vote

May be interested

  • How to Automatically Report on ExcelHow to Automatically Report on Excel
    today's tipsmake will guide you how to automatically report data on microsoft excel. this article also talks about how to query and create reports from external sources (mysql, postgres, oracle, etc.) right on your spreadsheet using the excel plug-in to link your spreadsheet to the source. that data. as for data stored on excel spreadsheets, we will use macro commands to create and export reports into many different file types with just one keystroke. luckily, excel has this feature built in, so you won't need to create your own algorithm.
  • Compare Microsoft Excel and Power BICompare Microsoft Excel and Power BI
    excel and power bi are two very popular tools. both offer a range of visualization and analysis tools to help you create dashboards and reports.
  • How to Automate Reports in ExcelHow to Automate Reports in Excel
    this wikihow teaches you how to automate the reporting of data in microsoft excel. for external data, this wikihow will teach you how to query and create reports from any external data source (mysql, postgres, oracle, etc) from within your...
  • MS Access 2003 - Lesson 22: Using Query WizardsMS Access 2003 - Lesson 22: Using Query Wizards
    access includes 4 different types of wizard queries, and only one where you can see all of those query types. select query from the insert menu, access displays the new query dialog box as shown in figure 1.
  • 7 ways to clean up data in Microsoft Excel7 ways to clean up data in Microsoft Excel
    spelling errors, extra spaces, duplicates, formula errors, and blank cells can all cause trouble when parsing spreadsheet data.
  • MS Access 2003 - Lesson 21: Chapter 6: Using Query to check dataMS Access 2003 - Lesson 21: Chapter 6: Using Query to check data
    in this chapter, you will learn how to filter and organize data, which is a powerful tool provided by access - queries.
  • Alternate Criteria in Access 2016Alternate Criteria in Access 2016
    in addition to the uses of the tipsmake.com query introduced in the previous lessons, you can also view data and records that meet two or more conditions using the alternative criteria.
  • Set up Query Criteria in Access 2016Set up Query Criteria in Access 2016
    the query criteria (query criteria) are filter conditions that help you retrieve specific items from an access database, used when you want to limit results based on values ​​in a field.
  • Power function (exponential) in ExcelPower function (exponential) in Excel
    power function (exponential) in excel - power function is a power function of a number of bases with a given exponent, if you do not understand the syntax or how to use the power function, you follow the article write below.
  • ENCODEURL function - The function returns a query string with URL code in ExcelENCODEURL function - The function returns a query string with URL code in Excel
    encodeurl function: the function returns a query string with the url code. support functions from excel 2013 onwards. syntax: encodeurl (text)