Power Query or Get & Transform (In Excel 2016) lets you perform a series of steps to transform your Excel data. One of the steps it allows you to take is to process flat data via the Modulo calculation in Power Query.
This is a really cool trick that you have to see! In our table, we have this flat sales data, and we want to extract just the names:
Imagine doing it by hand, it is going to take forever! But with Power Query, it will be done in a flash!
STEP 1: Select your data and go to Data > Get & Transform > From Table (Excel 2016) or Power Query > Excel Data > From Table (Excel 2013 & 2010)
Excel 2016:
Excel 2013 & 2010:
STEP 2: This will open up the Power Query Editor.
Notice that our flat sales data has a pattern. The pattern “Region, Salesperson Name, Sales” repeats every 3 rows!
Let as add an Index Column to number all of the rows. Go to Add Column > General > Index Column
STEP 3: This is where the magic happens!
Make sure the Index column is selected. Go to Add Column > Number Column > Standard > Modulo
Since our pattern repeats every 3 rows, let us type in 3. Click OK.
Now we have our modulo results.
STEP 4: Notice that the Salesperson name consistently matches the Modulo value 1? We can now extract the names quickly!
Click on the Filter icon of the Modulo column and make sure only 1 is ticked. This will hide the other unnecessary rows.
STEP 5: Click Close & Load from the Home tab and this will open up a brand new worksheet in your Excel workbook with the updated records!
You now have the names thanks to Modulo in Power Query!
How to Process Flat Data Using Modulo in Excel Using 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.