Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Excel Tutorial
  • Excel Formulas
  • Excel Shortcut Keys
  • Data Analysis in Excel
  • Formatting in Excel
  • Excel Workbooks
  • Statistical Functions
  • Data Visualization in Excel
  • Pivot Tables in Excel
  • MS Excel Quiz
  • Excel Interview Questions
  • Advance Excel
Open In App
Next Article:
Text Modifications with Power Query in Excel
Next article icon

Text Modifications with Power Query in Excel

Last Updated : 27 Jan, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

In Excel, Power Query is a business intelligence tool that is used to analyze the data imported from different sources. With the help of power query, we can easily clean, transform and reshape our data as per requirement along the way of analyzing the data. In this example, we will learn about the Text Functions which can be easily used with the help of Power BI for the modification of the data. Given below are the formatting functions that can be used to create and manipulate the text values.

Function Name

Description

Trim

It is used to trim(remove) the whitespace from both ends of the text.

Clean

It removes the non-printable characters from the text and returns it.

Merge Columns

It is used to combine two or more columns into a single column using a separator.

Lowercase

It is used to make text lowercase.

Uppercase

It is used to make text uppercase.

Add Prefix

It is used to add prefixes to a cell or set of cells.

Add Suffix

It is used to add suffixes to a cell or set of cells.

Capitalize Each Word

It is used to change a text into proper text.

Text Modifications with Power Query

Step 1: Create a Database.

In order to use the text operations, we will be using the following random names. 

Creating-database
Fig 1 - Database

In the above, we can see data is not clean, there is whitespace, some of the text start in lowercase and some are with uppercase. We will use the text formatting option to clean our data after that we will combine them in one column and then we will convert them into uppercase and lowercase.

Step 2: Open Power Query Editor.

In this step, we will open the power query editor window. For this Place Cursor in Table go to the Data tab at the top of the ribbon and then select From Table/Range option. Excel will open Power Query Editor.

opening-power-query-editor

Once we click on From Table/Range, Excel will automatically open the power query editor. Below, we can see in the power query editor window we have unwanted whitespaces.

power-query-editor-opens

Step 3: Remove Whitespaces.

In this step, we will remove the whitespace from both columns. For this Select Column then go to the Transform on the top of the ribbon then in the Text Column group choose Format and then select Trim.

Using-trim-function.
Fig 4 - Trim Function

Once we click on Trim option, excel will automatically remove the whitespaces from our column. Similarly, we need to do this for both columns. After we are done, we will get the following output.

After trim, we will get the following output.

Note: Whatever steps we do in Power Query Editor, all the steps are getting recorded in the APPLIED STEPS WINDOW. At any point in time, if we want to go back, we can use these steps.

applied-steps-window

Step 4: Combining Columns.

In this step, we will combine the two columns into a single column. For this Select Columns and then go to Transform on the top of the ribbon and then in the Text Columns group choose Merge Columns. 

combining-columns
Fig 7 - Merge Columns

Once we click on Merge Column excel, will open a window asking for the separator to be used while combining the columns. We can use any separator as per requirement (Here, we are using space as a separator while combining first and last name columns). Also, it will ask for the new columns name (Here, we are using Full Name as the new column name).

merging-columns

Once we click on OK, the power query will combine both columns into a single column with the name as Full Name.

full-name-merged-column

Step 5: Convert Text into Proper Text.

As we can see in the above picture, our data is not in proper form. Some of the letters are started lower and some of the words have uppercase letters in the middle. In this step, we will change our data into proper text. For this Select Column and then go to Transform on the top of the ribbon and then in the Text Columns group choose Format and then select Capitalize Each Word.

using-capitalize-each-word.

Once we click on Capitalize Each Word option excel will automatically convert our data into proper text.

proper-text

Step 6: Load Data into Excel Sheet.

Once we are done with our formatting, we can load our data from the power query editor to an excel sheet. For this go to the home tab on the top of the ribbon and then choose the Close & Load option.

using-Close-&-Load-option.

After we click on the Close & Load option, excel will create a new sheet and load our power query editor data into it.

Note: One of the important features of Power Query Editor is that, if we make any change in our original data, it will update the Power Query Editor's generated data automatically once we refresh the sheet.

new-sheet-for-dataset

Next Article
Text Modifications with Power Query in Excel

A

ankur035
Improve
Article Tags :
  • Excel
  • Technical Scripter 2022
  • Excel Power Query
  • ExcelGuide

Similar Reads

    Date Modifications with Power Query in Excel
    A data preparation and transformation engine is Power Query. Power Query includes a Power Query Editor for implementing transformations as well as a graphical interface for obtaining data from sources. With Power Query (also referred to as Get & Transform in Excel), you may import or connect to
    7 min read
    How to Create a Relative File Path with Power Query in Excel?
    In today's digital environment, sharing Excel files effectively is vital. A common issue is that Excel's Power Query uses absolute file paths, which can break when files are opened on different systems. To enhance portability and maintain data connections, it's crucial to convert these absolute path
    9 min read
    Master Power Query Excel in 2024: Step-by-Step Tutorial
    Mastering Power Query in Excel unlocks a powerful suite of tools for data transformation and analysis, enabling users to streamline their workflows and enhance productivity. As a feature integrated into Microsoft Excel, Power Query simplifies the process of importing, cleaning, and transforming data
    15 min read
    Loading Data with Power Pivot in Excel
    There are two ways to input data into Power Pivot: Data may be immediately loaded into PowerPivot, populating the database, or it can be loaded into Excel and added to the Data Model. You may either create connections and/or use the existing connections to import data into the Power Pivot Data Model
    5 min read
    Excel - Types of Merging of Queries in Power Query
    In Power Query, we have an option to Combine two tables using “Merge queries”. Merge Queries: Merge with current query with another queryMerge Queries as New: Merge with current query with another query and create New query In this article, we explore different types of merging of queries in Power Q
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences