How to get subtotal grouped by date using GETPIVOTDATA function in Excel

In this article, we will learn How to get subtotal grouped by date using the GETPIVOTDATA function in Excel.

Scenario:

Generally working with pivot tables, we need to find the specific sum values. These sum values having criteria over some date values can be extracted in Excel. For example if you need to find the sum of any field categorized by months or years with date values.

How to solve the problem?

Here we have a problem, the sum of entries with criteria as date value. The use of functions and a tool will help us get through the problem.

Firstly, a pivot table will be formed and it will be categorized with date values. Then the below formula will be used to find the sum with grouped criteria in the pivot table.

Generic formula:

= GETPIVOTDATA ( "Sum of field" , table_ref , ["field_1" , "crit_1"] , ["field_2" , "crit_1"] , .. )

Note :- Use the field header with correct keyword

Sum of field : field, where sum is required

table_ref : first reference field

field_1 : field criteria 1

crit_1 : criteria 1

 

Example:

All of these might be confusing to understand. So, let's test this formula via running it on the example shown below. For first, we will make a pivot table for the data.

Convert the given data to a pivot table using the pivot table option. Learn more about Get Pivot Table of data here. After getting the pivot table categorized the data with month index.

As you can see, the pivot table is here in the left and field settings on the right. But the problem of getting the sum of subtotal values is still here.

How to use the GETPIVOTDATA function with the Pivot table.

Here we have a pivot table and we need to find the sum of Quantity in March month. If we are doing the same task with data values instead of a pivot table, it will be a difficult task or require more than one function to solve this. Now to find the Sum of Quantity in March month, use the below shown formula.

Use the formula

= GETPIVOTDATA ( "Sum of Quantity" , A3 , "Months" , "Mar" )

Explanation:

  1. Sum of Quantity argument to find the Sum of Quantity field.
  2. A3 : table field reference cell
  3. "Months" table field selected to get the sum by month values.
  4. "Mar" March month selected where sum is required.
  5. GETPIVOTDATA function extracts the Sum of Quantity categorized as stated argument as explained above.

Press Enter to get the result. 

As you can see the formula returns 302 as the sum of Quantity in March month. Here you can say that this formula is very useful while working with a pivot table. Now to get the Sum of Price in Jan month from the pivot table, we will be using the same formula. 

Use the formula:

= GETPIVOTDATA ( "Sum of Price" , B3 , "Months" , "Jan" )

Sum of Price : Sum of Price values

B3 : corresponding table reference

"Months" : field criteria

"Jan" : criteria

As you can see, the formula returns the Sum of Price 1705.82 as marked in the table with a green arrow. Now you understand how to get a pivot table from data and after that finding out the subtotal grouped by date as criteria. Criteria can be given as an argument in the formula with quotes.

Here are all the observational notes regarding using the formula. 

Notes:

  1. Pivot table is a tool to create pivot tables but GETPIVOTDATA function extracts value from the pivot table.
  2. Pivot table only works with numbers value.
  3. You can get the Count, Sum , Average, variance or standard deviation of the data using the pivot table.
  4. Multiple criterias can be given in the formula separated by commas using quotation marks ("").
  5. Watch the formula keyword argument, as the formula returns #REF! Error if not used correctly.

Hope this article about How to get subtotal grouped by date using the GETPIVOTDATA function in Excel is explanatory. Find more articles on Pivot chart and table functions here. If you liked our blogs, share it with your friends on Facebook. And also you can follow us on Twitter and Facebook. We would love to hear from you, do let us know how we can improve, complement or innovate our work and make it better for you. Write us at info@exceltip.com

Related Articles:

Pivot Table : Crunch your data numbers in a go using the PIVOT table tool in Excel.

Dynamic Pivot Table : Crunch your newly added data with old data numbers using the dynamic PIVOT table tool in Excel.

Show hide field header in the pivot table : Edit ( show / hide ) field header of the PIVOT table tool in Excel.

How to Refresh Pivot Charts : Refresh your PIVOT charts  in Excel to get the updated result without any problem.

Popular Articles:

50 Excel Shortcut to Increase Your Productivity : Get faster at your task. These 50 shortcuts will make you work even faster on Excel.

How to use the VLOOKUP Function in Excel : This is one of the most used and popular functions of excel that is used to lookup value from different ranges and sheets. 

How to use the COUNTIF function in Excel : Count values with conditions using this amazing function. You don't need to filter your data to count specific values. Countif function is essential to prepare your dashboard.

How to Use SUMIF Function in Excel : This is another dashboard essential function. This helps you sum up values on specific conditions.

Leave a Reply

Your email address will not be published. Required fields are marked *

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.

Visit Us On TwitterVisit Us On FacebookVisit Us On Youtube