How to use pivot tables in Google Sheets

Amna Aslam
/
Mar 11, 2025
/
7
min read

A pivot table is a Google Sheets feature that helps you to summarize and analyze large datasets quickly. It enables you to reorganize, summarize, and extract insights from your data by creating a dynamic table that automatically performs calculations and aggregation based on the data you select.

In this article, we will provide various tutorials related to pivot tables in Google Sheets:

  • How to create a pivot table in Google Sheets;
  • How to add a calculated field to a pivot table in Google Sheets;
  • How to group data within a pivot table in Google Sheets;
  • How to add slicers to a pivot table in Google Sheets.

How to create a pivot table in Google Sheets

In this tutorial, you will learn how to create a pivot table in Google Sheets. For the purpose of exemplification, we will use a dataset of sales data of five products, five countries, and five salespeople, with the goal of finding out the number of items sold per country in 2014. However, you can use your own dataset for whatever calculations you need to perform.

Step 1: Set up your dataset in Google Sheets

First, you need to ensure that all your data is in a single sheet in Google Sheets.

Pro Tips:

  • There shouldn’t be any merged cells in your data.
  • Give a title to every column of your database.
  • Delete all empty rows and columns within your data sets.
  • Every item should be of the same data type in all columns(numbers, string).

In our case, our dataset includes the following variables:

  • Country;
  • Item type;
  • Salesperson name;
  • Unit sold;
  • Unit price;
  • Order date.
Set up your dataset in Google Sheets

Step 2: Select the data

Once you have all the data in Google Sheets, you need to select the range of cells where the data you wish to include in the pivot table can be found.

Step 2: Select the data

Step 3: Insert a pivot table

In order to insert a pivot table, navigate to the top menu bar in your Google Sheets and click on "Insert." A drop-down menu will appear, where you should choose "Pivot table."

Step 3: Insert a pivot table

Step 4: Click on “Create”

Because you selected the data range to be used to create a pivot table in Step 2, it will now appear in the dialogue box. However, you have the option to choose whether you want the pivot table to be inserted on a new sheet or on the existing sheet. We recommend that you select the “Existing sheet” option to preserve your data.

Once you’ve made your choice, you can simply click on “Create.”

Step 4: Click on “Create”

Step 5: Organize your pivot table

Now, you need to decide where each variable should go, rows, columns, values, or filters. Here’s our recommendation:

  • Categorical variables (e.g., gender, country, city, items name category): these are best suited for the columns and rows of your pivot table
  • Numerical variables (e.g., age, height, cost, unit price, unit sold, profit): these belong in the values section of your pivot table
  • Filtering specific results: if you want to focus on specific results, use filters.

Step 6: Add a categorical variable to the rows

In our example, in order to have the country names in every row, click on the “Add" button near “Rows” in your Pivot table editor. A drop-down menu will pop up, where you can select your chosen variable.

Step 6: Add a categorical variable to the rows

This step will result in rows being added to your pivot table as shown below:

Step 6: Add a categorical variable to the rows

Step 7: Add a categorical variable to the columns

In order to display a categorical variable in each column, click on the "Add" button near “Columns” in your Pivot table editor. In our example, we selected the “Item Type” as a column.

Step 7: Add a categorical variable to the columns

This step will result in columns being added to your pivot table.

Step 7: Add a categorical variable to the columns

Step 8: Add a numerical variable as values

Now you need values in your pivot table to perform calculations on your data. To fill the table with values, click on the “Add” button next to “Values” to choose a numerical variable. In our example, we chose “Units Sold.”

Step 8: Add a numerical variable as values

Values will now appear in your pivot table.

Step 8: Add a numerical variable as values

Step 9: Add a variable as a filter

Optionally, you can add a filter to your pivot table. In our example, we wanted to find the amount of units sold in 2014 and, in order to accomplish that, we need to use filters.

To add a filter, click on the "Add" button next to “Filters” and select the variable you want to use as a filter.

Step 9: Add a variable as a filter

In our example, because we selected the variable Order Date, it allowed us to choose which dates we wanted. As we only wanted to find the number of units sold in 2014, we selected all the dates in the year 2014, and then clicked on “Ok.”

Step 9: Add a variable as a filter

Voila! You have created a pivot table in Google Sheets.

Step 9: Add a variable as a filter

How to add a calculated field to a pivot table in Google Sheets

Pivot tables in Google Sheets can have multiple formulas and functions, which you can use to perform specific calculations. The following is a step-by-step method you can use to add a calculated field to your pivot table.

In our example, we will calculate continent-wise sales for the fourth quarter of the year, using our dataset with 3 months’ sales data of employees from 3 different continents – Europe, Africa, and Asia.

Step 1: Ensure your pivot table is ready

Once you have a pivot table, you need to ensure that you have your desired categorical pivot as rows. In our example, that’s the variable Continent, so that each continent in our dataset is displayed per row.

Step 1: Ensure your pivot table is ready

Step 2: Add a calculated field

Now, it’s time to add the calculated field. In our example, we want to combine and calculate data from three different columns.

Step 2.1: Click on “Add” next to “Values”

To add the calculated field, click on the “Add” button next to “Values.”

Add a calculated field

Step 2.2: Select “Calculated Field”

In the drop-down menu that appeared, select the “Calculated Field” option.

Step 2.2: Select “Calculated Field”

This step will result in the adding of a new column to your pivot table.

Step 2.2: Select “Calculated Field”

Step 3: Select “SUM”

Now that you added a calculated field, you need to select whether you want to sum values or do something custom. In our case, we want to select “SUM.”

Step 3: Select “SUM”

Step 4: Write the formula

In the formula section, write the formula to be used to calculate the values in the calculated field.

In our example, because we want to sum the values of October, November and December, we added the following formula: October+November+December.

Step 4: Write the formula

Step 5: The calculated field has been added to your pivot table

Because you followed all the previous steps, you can see the result of the calculation you set up.

In our example, we can see the total revenue generated in a quarter in three continents in the pivot table.

Step 5: The calculated field has been added to your pivot table

How to group data within a Google Sheets pivot table

Grouping data involves collecting similar data into categories based on shared criteria, such as years, geographic regions, and salary ranges.

In our example, we‘ll group data according to the year. Specifically, we want to analyze the data related to the year 2015.

Step 1: Select the data to be grouped

First, you need to select the data you want to group and then right-click. In our example, we selected the dates that belong to the year of 2015.

Step 1: Select the data to be grouped

Step 2: Click on “Create pivot group”

In the drop-down menu, click on “Create pivot group.”

Step 2: Click on “Create pivot group”

Step 3: Your data is now grouped

Congratulations! Your pivot table now features grouped data for the year 2015.

Step 3: Your data is now grouped

How to add slicers to a pivot table in Google Sheets

Slicers in Google Sheets can simplify the process of filtering data within your pivot table. Think of a slicer as a tool that lets you trim down the data you don't need, turning visible only the information you need to focus on.

This time, we‘ll show you an example of how to use slicers in a pivot table with a dataset of properties sold by different real estate agents.

Step 1: Click on “Data”

Once you have a pivot table, click on "Data” on the top menu.

Step 1: Click on “Data”

Step 2: Click on “Add a Slicer”

In the drop-down menu, click on "Add a slicer."

Step 2: Click on “Add a Slicer”

Step 3: Specify the data range

A slicer bar will appear, along with a window, where you need to specify the data range to which you want to apply the slicer.

For our example, let's use the cell range A1:G7, so that it includes all the data in our pivot table.

Step 3: Specify the data range

Step 4: Choose the aspect you want to analyze

In the Slicer panel, under the Column section, use the dropdown menu to select what you want to analyze.

In our example, we chose "SUM of Closed,” because we want to see the amount of properties sold, not their type.

Step 4: Choose the aspect you want to analyze

Step 5: Filter the data

Now, you can use the slicer to exclude the data from the pivot table that is irrelevant to your data analysis. To do so, click on the slicer bar, and uncheck the values that you want to hide. Once you’re done, click on “OK.”

Step 5: Filter the data

Step 6: You have added a slicer to your pivot table

That’s it! You’ve successfully added a slicer to your pivot table. In our example, we hid all the data related to Noah Smith from the pivot table.

Step 6: You have added a slicer to your pivot table
What is Softr
Softr is the easiest way to turn your data into powerful business apps—no code required. Connect to your spreadsheet or database, customize layout and logic, and share with your team or clients.

Join 700,000+ users worldwide, building client portals, internal tools, CRMs, dashboards, project management systems, inventory management apps, and more—all without code.
Get started free
Amna Aslam

Categories
Google Sheets
Guide

Build an app today. It’s free!

Build and launch your first portal or internal tool in under 30 minutes
Get started free