0% found this document useful (0 votes)
37 views

Power Query of Excel 13

Uploaded by

Prosenjit Mitra
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Power Query of Excel 13

Uploaded by

Prosenjit Mitra
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

STUDY / PRACTICE NOTES FOR SESSION 28 & 29

Mastering Power Query in Excel

Importing, Cleaning, and Transforming Data

1. Import Data from Different Sources

Excel Workbooks:

You can import data from multiple sheets within an Excel workbook to centralize your analysis.

Steps:

1. Open Power Query:


o Go to the Data tab in Excel and select Get Data > From Workbook.
2. Select the Workbook:
o Choose the Excel file and specify which sheets or ranges you want to import.
3. Load Multiple Sheets:
o Once imported, you can combine data from multiple sheets by using Append or
Merge Queries in Power Query.

CSV Files:

CSV files are another common source of data, and Excel can easily import them.

Steps:

1. Open Power Query:


o Go to Data > Get Data > From Text/CSV.
2. Select the CSV File:
o Browse and select the CSV file. Power Query will display a preview of the data.
3. Load and Edit Data:
o Load the data directly into Excel or edit it using the Power Query editor.

Online Data:

You can also connect to data on the web or from databases.

Steps:

1. Open Power Query:


o Go to Data > Get Data > From Web.
2. Enter URL:
o Enter the URL of the web page or database from which you want to import data.
3. Load Data:
o Power Query will parse the data, allowing you to select specific tables or sections
for import.

2. Cleaning Data

Once data is imported, cleaning it is essential for accurate analysis.


STUDY / PRACTICE NOTES FOR SESSION 28 & 29

Remove Duplicates:

Duplicate rows can distort your analysis, so removing them is critical.

Steps:

1. Open Power Query:


o Select your data and open Power Query.
2. Remove Duplicates:
o In Power Query, select the column(s) where duplicates might occur.
o Go to Home > Remove Duplicates.

Filter Rows:

Filtering out irrelevant data can help you focus on key information.

Steps:

1. Open Power Query.


2. Apply Filters:
o Select the column you want to filter by, then apply filters (e.g., remove rows with
null values or outliers).

Replace Values:

You may need to standardize or correct data by replacing certain values.

Steps:

1. Open Power Query.


2. Replace Values:
o Go to Transform > Replace Values.
o Specify the old and new values.

3. Transform Data

Data transformations are often needed to structure the data for analysis.

Split Columns:

This function is useful for separating values like full names, addresses, or product codes into
different columns.

Steps:

1. Open Power Query.


2. Select Column to Split:
o Highlight the column, then go to Home > Split Column.
o Choose the delimiter (e.g., comma, space, or custom delimiter).
STUDY / PRACTICE NOTES FOR SESSION 28 & 29

Merge Columns:

When needed, you can combine multiple columns (e.g., first and last names) into one.

Steps:

1. Select Columns:
o Highlight the columns you want to combine.
2. Merge Columns:
o In Power Query, go to Transform > Merge Columns.
o Choose a separator (e.g., space, comma) and provide a new column name.

Change Data Types:

It's essential to ensure that the data types (e.g., numbers, text, dates) are correct for analysis.

Steps:

1. Select the Column:


o In Power Query, highlight the column you need to adjust.
2. Change Data Type:
o Go to Transform > Data Type and choose the appropriate type (e.g., number,
text, date).

4. Unpivot Data

Unpivoting data is useful when dealing with wide-format tables (e.g., months as columns) that
you want to convert into long format.

Steps:

1. Select Columns to Unpivot:


o In Power Query, select the columns that you want to unpivot (e.g., month
columns).
2. Unpivot Columns:
o Go to Transform > Unpivot Columns.
3. Result:
o Your data will now be in long format, with each row representing an observation
rather than wide format with multiple columns representing months.

Example of Using All Functions:

Let's assume you have an Excel workbook with sales data split across different sheets, and you
want to combine them, clean the data by removing duplicates, split product codes, and
transform the dataset.

 Import: You import data from different sheets in the workbook.


 Clean: Remove duplicate sales entries and filter out any rows with zero sales.
STUDY / PRACTICE NOTES FOR SESSION 28 & 29

 Transform: Split the product codes into separate columns for category and ID, and then
merge the columns for product name.
 Unpivot: Finally, unpivot the data to have one column for the month and another for the
sales amount.

This process will result in a clean and structured dataset ready for analysis or reporting in Excel.

By using Excel's Power Query, you can automate many of these tasks and update your data with
a single click when new data is available.

You might also like