Blogs

Calculating Frequency using MS Excel Power Query

By Anna Kourouniotis posted 22 days ago

  

Hey Reporting and Analytics folks,

In the midst of preparing for a data storytelling workshop I came across the need to create a frequency table, which is basically a way to organize data into categories and show how often each category appears. It helps to quickly see patterns, trends, and distributions in a dataset. Initially, I thought about using Chat-GPT or Microsoft Copilot to come up with a quick solution since I probably would only need to do this once and won't be refreshing that data. However, I wanted to provide my learners with a solution that they could take back with them and apply it to their own data projects. Since I am using Microsoft Excel as my data analysis, prep, and visualization tool - excellent in terms of ubiquity and accessibility as it's widely available and has a low barrier to entry - I decided to take advantage of a very powerful functionality known as Power Query. To access this robust transformation functionality, check out the Data tab and specifically the Get & Transform and Queries & Connections options in the ribbon. Here are the steps I took to create a frequency calculation and the resulting table of values:

Start with the data:
Below are the compiled responses for my survey question, "What factors most influenced your current career path?" Note that respondents could select multiple answers.

Influence Total responses
Job market/opportunities 8
Job market/opportunities, Life circumstances 8
Job market/opportunities, Networking or mentors 3
Job market/opportunities, Networking or mentors, Life circumstances 1
Job market/opportunities, Networking or mentors, Personal interest or passion 1
Job market/opportunities, Networking or mentors, Personal interest or passion, Life circumstances 1
Job market/opportunities, Personal interest or passion 5
Job market/opportunities, Personal interest or passion, Life circumstances 5
Life circumstances 2
Life circumstances, right place right time, I was originally a student work in the bursar office and got hired full time.  As I learned more I was given more oppurtunities 1
My college major, Job market/opportunities 1
My college major, Job market/opportunities, Life circumstances 2
My college major, Job market/opportunities, Networking or mentors, Personal interest or passion 1
My college major, Job market/opportunities, Networking or mentors, Personal interest or passion, Life circumstances 1
My college major, Personal interest or passion 1
Networking or mentors 1
Networking or mentors, Personal interest or passion 1
Networking or mentors, Personal interest or passion, Life circumstances 1
Personal interest or passion 1
Personal interest or passion, Life circumstances 5

Set your Goal: Count how many times each individual reason (like "Personal passion", "Academic strengths", etc.) appears, weighted by the count from the "Responses" column.

Go through the Steps:

1. Select Your Data
Make sure your data is in a table format.
Select your range (including headers: “Influence” and “Total Responses”).
Press Ctrl + T (or go to Insert → Table).
Name the table something simple like SourceData.
2. Load to Power Query
Click anywhere in the table.
Go to the Data tab → Click From Table/Range.
Power Query Editor opens.
3. Split the Multi-Value Column
You're splitting the “Influence” column into individual items.
Select the "Influence" column.
Go to Home → Split Column → By Delimiter.
Choose Comma ( , ) as the delimiter.
Select the Advanced options.
Select "Split into Rows".
Select "none" for Quote Character.
This will duplicate the count for each individual reason.
4. Clean the Text
Trim spaces from the split values.
Right-click the column with individual reasons (still called “Influence”).
Go to Transform → Format → Trim.
5. Group and Summarize
Now you’ll count how often each individual reason appears, factoring in the count column.
Go to Home → Group By.
Group by: Influence.
Operation: Sum on the “Responses” column.
Name the new column: Total Count.
6. Load to Worksheet
Click Home → Close & Load.
Your frequency table is now in Excel.

Enjoy the End Result: frequency table

Influence Total Count
Job market/opportunities 37
Life circumstances 27
Personal interest or passion 23
Networking or mentors 11
My college major 6
Right place Right Time 1
I was originally a student work in the bursar office and got hired full time.  As I learned more I was given more opportunities 1

What do you think of this technique? Are you using Excel's Query functionality to transform data? 


#Reporting
#Excel
0 comments
12 views

Permalink