Power Query or Get & Transform (In Excel 2016) lets you perform a series of steps to transform your Excel data. You can do a lot of things and sometimes we end up with a fairly long query! One cool thing is you can split a query into two parts to make it more readable!
We will use an existing spreadsheet wherein we used Power Query to extract the names from this tutorial.
We extracted the names only from this:
Into this resulting table:
We want to split this query into two parts! Let us see how we can do it below.
STEP 1: Let us edit the existing Query in the spreadsheet. Go to Data > Get & Transform > Show Queries
Double click on the query (Table1):
STEP 2: This will open up the Power Query Editor.
Our query contains two main sections:
- Setup and Adding an Index Column
- Using the Modulo to Filter rows
We want to separate these two sections as shown below.
We want to split it. Right click on Inserted Modulo and select Extract Previous
STEP 3: This is where the magic happens!
The steps on top will be moved to a new query. Type in the name Setup and Index.
Now it is split into two parts! See the first query Setup and Index.
It is then followed by the second query that has the modulo and filtering steps.
If you check the source of Query #2, you can see that its source is Query #1 Setup and Index. You have successfully split your query into two parts!
How to Split a Query into Two Parts in Power Query
Bryan
Bryan Hong is an IT Software Developer for more than 10 years and has the following certifications: Microsoft Certified Professional Developer (MCPD): Web Developer, Microsoft Certified Technology Specialist (MCTS): Windows Applications, Microsoft Certified Systems Engineer (MCSE) and Microsoft Certified Systems Administrator (MCSA).
He is also an Amazon #1 bestselling author of 4 Microsoft Excel books and a teacher of Microsoft Excel & Office at the MyExecelOnline Academy Online Course.