Formula for pivot table in excel

In PivotTables, you can use summary functions in value fields to combine values from the underlying source data. If summary functions and custom calculations do not provide the results that you want, you can create your own formulas in calculated fields and calculated items. For example, you could add a calculated item with the formula for the sales commission, which could be different for each region. The PivotTable would then automatically include the commission in the subtotals and grand totals.

Another way to calculate is to use Measures in Power Pivot, which you create using a Data Analysis Expressions (DAX) formula. For more information, see Create a Measure in Power Pivot.

PivotTables provide ways to calculate data. Learn about the calculation methods that are available, how calculations are affected by the type of source data, and how to use formulas in PivotTables and PivotCharts.

To calculate values in a PivotTable, you can use any or all of the following types of calculation methods:

  • Summary functions in value fields    The data in the values area summarize the underlying source data in the PivotTable. For example, the following source data:

    Example of PivotTable source data

  • Produces the following PivotTables and PivotCharts. If you create a PivotChart from the data in a PivotTable, the values in that PivotChart reflect the calculations in the associated PivotTable report.

    Example of PivotTable report

    Example of a PivotChart report

  • In the PivotTable, the Month column field provides the items March and April. The Region row field provides the items North, South, East, and West. The value at the intersection of the April column and the North row is the total sales revenue from the records in the source data that have Month values of April and Region values of North.

  • In a PivotChart, the Region field might be a category field that shows North, South, East, and West as categories. The Month field could be a series field that shows the items March, April, and May as series represented in the legend. A Values field named Sum of Sales could contain data markers that represent the total revenue in each region for each month. For example, one data marker would represent, by its position on the vertical (value) axis, the total sales for April in the North region.

  • To calculate the value fields, the following summary functions are available for all types of source data except Online Analytical Processing (OLAP) source data.

    Function

    Summarizes

    Sum

    The sum of the values. This is the default function for numeric data.

    Count

    The number of data values. The Count summary function works the same as the COUNTA function. Count is the default function for data other than numbers.

    Average

    The average of the values.

    Max

    The largest value.

    Min

    The smallest value.

    Product

    The product of the values.

    Count Nums

    The number of data values that are numbers. The Count Nums summary function works the same as the COUNT function.

    StDev

    An estimate of the standard deviation of a population, where the sample is a subset of the entire population.

    StDevp

    The standard deviation of a population, where the population is all of the data to be summarized.

    Var

    An estimate of the variance of a population, where the sample is a subset of the entire population.

    Varp

    The variance of a population, where the population is all of the data to be summarized.

  • Custom calculations    A custom calculation shows values based on other items or cells in the data area. For example, you could display values in the Sum of Sales data field as a percentage of March sales, or as a running total of the items in the Month field.

    The following functions are available for custom calculations in value fields.

    Function

    Result

    No Calculation

    Displays the value that is entered in the field.

    % of Grand Total

    Displays values as a percentage of the grand total of all of the values or data points in the report.

    % of Column Total

    Displays all of the values in each column or series as a percentage of the total for the column or series.

    % of Row Total

    Displays the value in each row or category as a percentage of the total for the row or category.

    % Of

    Displays values as a percentage of the value of the Base item in the Base field.

    % of Parent Row Total

    Calculates values as follows:

    (value for the item) / (value for the parent item on rows)

    % of Parent Column Total

    Calculates values as follows:

    (value for the item) / (value for the parent item on columns)

    % of Parent Total

    Calculates values as follows:

    (value for the item) / (value for the parent item of the selected Base field)

    Difference From

    Displays values as the difference from the value of the Base item in the Base field.

    % Difference From

    Displays values as the percentage difference from the value of the Base item in the Base field.

    Running Total in

    Displays the value for successive items in the Base field as a running total.

    % Running Total in

    Calculates the value for successive items in the Base field that are displayed as a running total as a percentage.

    Rank Smallest to Largest

    Displays the rank of selected values in a specific field, listing the smallest item in the field as 1, and each larger value will have a higher rank value.

    Rank Largest to Smallest

    Displays the rank of selected values in a specific field, listing the largest item in the field as 1, and each smaller value will have a higher rank value.

    Index

    Calculates values as follows:

    ((value in cell) x (Grand Total of Grand Totals)) / ((Grand Row Total) x (Grand Column Total))

  • Formulas    If summary functions and custom calculations do not provide the results that you want, you can create your own formulas in calculated fields and calculated items. For example, you could add a calculated item with the formula for the sales commission, which could be different for each region. The report would then automatically include the commission in the subtotals and grand totals.

Calculations and options that are available in a report depend on whether the source data came from an OLAP database or a non-OLAP data source.

  • Calculations based on OLAP source data    For PivotTables that are created from OLAP cubes, the summarized values are precalculated on the OLAP server before Excel displays the results. You cannot change how these precalculated values are calculated in the PivotTable. For example, you cannot change the summary function that is used to calculate data fields or subtotals, or add calculated fields or calculated items.

    Also, if the OLAP server provides calculated fields, known as calculated members, you will see these fields in the PivotTable Field List. You will also see any calculated fields and calculated items that are created by macros that were written in Visual Basic for Applications (VBA) and stored in your workbook, but you won’t be able to change these fields or items. If you need additional types of calculations, contact your OLAP database administrator.

    For OLAP source data, you can include or exclude the values for hidden items when calculating subtotals and grand totals.

  • Calculations based on non-OLAP source data    In PivotTables that are based on other types of external data or on worksheet data, Excel uses the Sum summary function to calculate value fields that contain numeric data, and the Count summary function to calculate data fields that contain text. You can choose a different summary function, such as, Average, Max, or Min, to further analyze and customize your data. You can also create your own formulas that use elements of the report or other worksheet data by creating a calculated field or a calculated item within a field.

You can create formulas only in reports that are based on a non-OLAP source data. You cannot use formulas in reports that are based on an OLAP database. When you use formulas in PivotTables, you should know about the following formula syntax rules and formula behavior:

  • PivotTable formula elements    In formulas that you create for calculated fields and calculated items, you can use operators and expressions as you do in other worksheet formulas. You can use constants and refer to data from the report, but you cannot use cell references or defined names. You cannot use worksheet functions that require cell references or defined names as arguments, and you cannot use array functions.

  • Field and item names    Excel uses field and item names to identify those elements of a report in your formulas. In the following example, the data in range C3:C9 is using the field name Dairy. A calculated item in the Type field that estimates sales for a new product based on Dairy sales could use a formula such as =Dairy * 115%.

    Example PivotTable report

    Note: In a PivotChart, the field names are displayed in the PivotTable field list, and item names can be seen in each field drop-down list. Don’t confuse these names with those you see in chart tips, which reflect series and data point names instead.

  • Formulas operate on sum totals, not individual records    Formulas for calculated fields operate on the sum of the underlying data for any fields in the formula. For example, the calculated field formula =Sales * 1.2 multiplies the sum of the sales for each type and region by 1.2; it does not multiply each individual sale by 1.2 and then sum the multiplied amounts.

    Formulas for calculated items operate on the individual records. For example, the calculated item formula =Dairy *115% multiplies each individual sale of Dairy times 115%, after which the multiplied amounts are summarized together in the Values area.

  • Spaces, numbers, and symbols in names    In a name that includes more than one field, the fields can be in any order. In the example above, cells C6:D6 can be ‘April North’ or ‘North April’. Use single quotation marks around names that are more than one word or that include numbers or symbols.

  • Totals    Formulas cannot refer to totals (such as, March Total, April Total, and Grand Total in the example).

  • Field names in item references    You can include the field name in a reference to an item. The item name must be in square brackets — for example, Region[North]. Use this format to avoid #NAME? errors when two items in two different fields in a report have the same name. For example, if a report has an item named Meat in the Type field and another item named Meat in the Category field, you can prevent #NAME? errors by referring to the items as Type[Meat] and Category[Meat].

  • Referring to items by position    You can refer to an item by its position in the report as currently sorted and displayed. Type[1] is Dairy, and Type[2] is Seafood. The item referred to in this way can change whenever the positions of items change or different items are displayed or hidden. Hidden items are not counted in this index.

    You can use relative positions to refer to items. The positions are determined relative to the calculated item that contains the formula. If South is the current region, Region[-1] is North; if North is the current region, Region[+1] is South. For example, a calculated item could use the formula =Region[-1] * 3%. If the position that you give is before the first item or after the last item in the field, the formula results in a #REF! error.

To use formulas in a PivotChart, you create the formulas in the associated PivotTable, where you can see the individual values that make up your data, and then you can view the results graphically in the PivotChart.

For example, the following PivotChart shows sales for each salesperson per region:

PivotChart report showing sales for each salesperson per region

To see what sales would look like if they were increased by 10 percent, you could create a calculated field in the associated PivotTable that uses a formula such as =Sales * 110%.

The result immediately appears in the PivotChart, as shown in the following chart:

PivotChart report showing sales increased by 10 percent per region

To see a separate data marker for sales in the North region minus a transportation cost of 8 percent, you could create a calculated item in the Region field with a formula such as =North – (North * 8%).

The resulting chart would look like this:

PivotChart report with a calculated item.

However, a calculated item that is created in the Salesperson field would appear as a series represented in the legend and appear in the chart as a data point in each category.

Important: You cannot create formulas in a PivotTable that is connected to an Online Analytical Processing (OLAP) data source.

Before you start, decide whether you want a calculated field or a calculated item within a field. Use a calculated field when you want to use the data from another field in your formula. Use a calculated item when you want your formula to use data from one or more specific items within a field.

For calculated items, you can enter different formulas cell by cell. For example, if a calculated item named OrangeCounty has a formula of =Oranges * .25 across all months, you can change the formula to =Oranges *.5 for June, July, and August.

If you have multiple calculated items or formulas, you can adjust the order of calculation.

Add a calculated field

  1. Click the PivotTable.

    This displays the PivotTable Tools, adding the Analyze and Design tabs.

  2. On the Analyze tab, in the Calculations group, click Fields, Items, & Sets, and then click Calculated Field.

    Excel Ribbon Image

  3. In the Name box, type a name for the field.

  4. In the Formula box, enter the formula for the field.

    To use the data from another field in the formula, click the field in the Fields box, and then click Insert Field. For example, to calculate a 15% commission on each value in the Sales field, you could enter = Sales * 15%.

  5. Click Add.

Add a calculated item to a field

  1. Click the PivotTable.

    This displays the PivotTable Tools, adding the Analyze and Design tabs.

  2. If items in the field are grouped, on the Analyze tab, in the Group group, click Ungroup.

    Excel Ribbon Image

  3. Click the field where you want to add the calculated item.

  4. On the Analyze tab, in the Calculations group, click Fields, Items, & Sets, and then click Calculated Item.

    Excel Ribbon Image

  5. In the Name box, type a name for the calculated item.

  6. In the Formula box, enter the formula for the item.

    To use the data from an item in the formula, click the item in the Items list, and then click Insert Item (the item must be from the same field as the calculated item).

  7. Click Add.

Enter different formulas cell by cell for calculated items

  1. Click a cell for which you want to change the formula.

    To change the formula for several cells, hold down CTRL and click the additional cells.

  2. In the formula bar, type the changes to the formula.

Adjust the order of calculation for multiple calculated items or formulas

  1. Click the PivotTable.

    This displays the PivotTable Tools, adding the Analyze and Design tabs.

  2. On the Analyze tab, in the Calculations group, click Fields, Items, & Sets, and then click Solve Order.

    Excel Ribbon Image

  3. Click a formula, and then click Move Up or Move Down.

  4. Continue until the formulas are in the order that you want them to be calculated.

You can display a list of all the formulas that are used in the current PivotTable.

  1. Click the PivotTable.

    This displays the PivotTable Tools, adding the Analyze and Design tabs.

  2. On theAnalyze tab, in the Calculations group, click Fields, Items, & Sets, and then click List Formulas.

    Excel Ribbon Image

Before you edit a formula, determine whether that formula is in a calculated field or a calculated item. If the formula is in a calculated item, also determine whether the formula is the only one for the calculated item.

For calculated items, you can edit individual formulas for specific cells of a calculated item. For example, if a calculated item named OrangeCalc has a formula of =Oranges * .25 across all months, you can change the formula to =Oranges *.5 for June, July, and August.

Determine whether a formula is in a calculated field or a calculated item

  1. Click the PivotTable.

    This displays the PivotTable Tools, adding the Analyze and Design tabs.

  2. On the Analyze tab, in the Calculations group, click Fields, Items, & Sets, and then click List Formulas.

    Excel Ribbon Image

  3. In the list of formulas, find the formula that you want to change listed under Calculated Field or Calculated Item.

    When there are multiple formulas for a calculated item, the default formula that was entered when the item was created has the calculated item name in column B. For additional formulas for a calculated item, column B contains both the calculated item name and the names of intersecting items.

    For example, you might have a default formula for a calculated item named MyItem, and another formula for this item identified as MyItem January Sales. In the PivotTable, you would find this formula in the Sales cell for the MyItem row and January column.

  4. Continue by using one of the following editing methods.

Edit a calculated field formula

  1. Click the PivotTable.

    This displays the PivotTable Tools, adding the Analyze and Design tabs.

  2. On the Analyze tab, in the Calculations group, click Fields, Items, & Sets, and then click Calculated Field.

    Excel Ribbon Image

  3. In the Name box, select the calculated field for which you want to change the formula.

  4. In the Formula box, edit the formula.

  5. Click Modify.

Edit a single formula for a calculated item

  1. Click the field that contains the calculated item.

  2. On the Analyze tab, in the Calculations group, click Fields, Items, & Sets, and then click Calculated Item.

    Excel Ribbon Image

  3. In the Name box, select the calculated item.

  4. In the Formula box, edit the formula.

  5. Click Modify.

Edit an individual formula for a specific cell of a calculated item

  1. Click a cell for which you want to change the formula.

    To change the formula for several cells, hold down CTRL and click the additional cells.

  2. In the formula bar, type the changes to the formula.

    Tip: If you have multiple calculated items or formulas, you can adjust the order of calculation. For more information, see Adjust the order of calculation for multiple calculated items or formulas.

Note: Deleting a PivotTable formula removes it permanently. If you do not want to remove a formula permanently, you can hide the field or item instead by dragging it out of the PivotTable.

  1. Determine whether the formula is in a calculated field or a calculated item.

    Calculated fields appear in the PivotTable Field List. Calculated items appear as items within other fields.

  2. Do one of the following:

    • To delete a calculated field, click anywhere in the PivotTable.

    • To delete a calculated item, in the PivotTable, click the field that contains the item that you want to delete.

      This displays the PivotTable Tools, adding the Analyze and Design tabs.

  3. On the Analyze tab, in the Calculations group, click Fields, Items, & Sets, and then click Calculated Field or Calculated Item.

    Excel Ribbon Image

  4. In the Name box, select the field or item that you want to delete.

  5. Click Delete.

To summarize values in a PivotTable in Excel for the web, you can use summary functions like Sum, Count, and Average. The Sum function is used by default for numeric values in value fields. You can view and edit a PivotTable based on an OLAP data source, but you can’t create one in Excel for the web.

Here’s how to choose a different summary function:

  1. Click anywhere on the PivotTable, and then select PivotTable > Field List.  You can also right-click the PivotTable and then select Show Field List.

  2. In the PivotTable Fields list, under Values, click the arrow next to the value field.

    The Values box in the Field List

  3. Click Value Field Settings.

  4. Pick the summary function you want and then click OK.

    Note: Summary functions aren’t available in PivotTables that are based on Online Analytical Processing (OLAP) source data.

    Use this summary function

    To calculate

    Sum

    The sum of the values. It’s used by default for value fields that have numeric values.

    Count

    The number of nonempty values. The Count summary function works the same as the COUNTA function. Count is used by default for value fields that have nonnumeric values or blanks.

    Average

    The average of the values.

    Max

    The largest value.

    Min

    The smallest value.

    Product

    The product of the values.

    Count Numbers

    The number of values that contain numbers (not the same as Count, which includes nonempty values).

    StDev

    An estimate of the standard deviation of a population, where the sample is a subset of the entire population.

    StDevp

    The standard deviation of a population, where the population is all of the data to be summarized.

    Var

    An estimate of the variance of a population, where the sample is a subset of the entire population.

    Varp

    The variance of a population, where the population is all of the data to be summarized.

Need more help? 

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

Pivot Table Formula in Excel

Pivot Table Formula in Excel (Table of Content)

  • Pivot Table Formula in Excel
  • Custom Field to Calculate Profit Amount
  • Advanced Formula in Calculated Field

Pivot Table Formula in Excel

In Excel, we can add and modify the formula available in default calculated fields once we create a pivot table. To see and update the pivot table formula, create a pivot table with relevant fields we want to keep. After selecting or putting the cursor on it, select Calculated Fields from the drop-down list of Fields, Items & Sets from Analyze menu ribbon. There we will be able to see all the fields used in the pivot table along with the section Name and Formula section.

Custom Field to Calculate Profit Amount

You can download this Pivot Table Formula Excel Template here – Pivot Table Formula Excel Template

This is the most often used calculated field in the pivot table. Please take a look at the below data; I have Country Name, Product Name, Units Sold, Unit Price, Gross Sales, COGS (Cost of Goods Sold), Date, and Year column.

Pivot Table Formula in Excel 1

Let me apply the pivot table to find the total sales and total cost for each country. Below is the pivot table for the above data.

Pivot Table Formula in Excel 2

Pivot Table Formula in Excel 3

The problem is I don’t have a profit column in the source data. I need to find out the profit and profit percentage for each country. We can add these two columns to the pivot table itself.

Step 1: Select a cell in the pivot table. Go to Analyze tab in the ribbon and select Fields, Items, & Sets. Under this, select Calculated Field.

Pivot Table Formula in Excel 4

Step 2: In the below dialog box, give a name to your new calculated field.

Pivot Table Formula in Excel 5

Step 3: In the Formula section, apply the formula to find the Profit. The formula to find the Profit is Gross Sales – COGS.

Go inside the formula bar > Select Gross Sales from the below Field and double click it will appear in the Formula bar.

Pivot Table Formula in Excel 6

Now type minus symbol ( – ) and select COGS > Double click.

Pivot Table Formula in Excel 7

Step 4: Click on ADD and OK to complete the formula.

Pivot Table Formula in Excel 7.1

Step 5: Now, we have our TOTAL PROFIT Column in the pivot table.

Pivot Table Formula in Excel 8

This calculated field is flexible, it is not only limited to Country-wise analysis, but we can use this for all kinds of analysis. If I want to see the analysis country-wise and product-wise, I just have to drag and drop the product column to the ROW field; it will show the breakup of profit for each product under each country.

Pivot Table Formula in Excel 9

Pivot Table Formula in Excel 10

Step 6: Now, we need to calculate the profit percentage. The formula to calculate the Profit Percentage is Total Profit / Gross Sales.

Go to Analyze and again select Calculated Field under Fields, Items, & Sets.

Step 7: Now, we must see the newly inserted calculated field Total Profit in the Fields list. Insert this field to the formula.

Pivot Table Formula in Excel 11

Step 8: Type divider symbol (/) and insert Gross Sales Field.

Pivot Table Formula in Excel 12

Step 9: Name this Calculated Field as Profit Percentage.

Pivot Table Formula in Excel 13

Step 10: Click on ADD and OK to complete the formula. We have Profit Percentage as the new column.

Pivot Table Formula in Excel 14

Advanced Formula in Calculated Field

Whatever I have shown now is the basic stuff of Calculated Field. In this example, I will show you the advanced formulas in pivot table calculated fields. Now I want to calculate the incentive amount based on the profit percentage.

If the Profit % is >15% incentive should be 6% of the total profit.

If the Profit % is >10% incentive should be 5% of the total profit.

If the Profit % is <10% incentive should be 3% of the total profit.

Step 1: Go to Calculated Field and open the below dialog box. Give the name as Incentive Amount.

Advanced Formula in Calculated Field 1

Step 2: Now, I will use the IF condition to calculate the incentive amount. Apply the below formulas as shown in the image.

=IF (‘ProfitPercentage’>15%, ‘TotalProft’*6%, IF(‘ProfitPercentage’>10%, ‘Total Proft’*5%, ‘Total Proft’ *3%))

Advanced Formula in Calculated Field 2

Step 3: Click on ADD & OK to complete. Now we have an Incentive Amount column.

Advanced Formula in Calculated Field 3

Limitation of Calculated Field

We have seen the wonder of Calculated Fields, but it has some of the limitations as well. Now take a look at the below image; if I want to see the breakup of the Product-wise Incentive amount, we will have the wrong SUB TOTAL & GRAND TOTAL of INCENTIVE AMOUNT.

Advanced Formula in Calculated Field 4

So be careful while showing the Subtotal of calculated fields. It will show you the wrong amounts.

Get a List of All the Calculated Field Formulas

If you do not know how many formulas are there in the pivot table calculated field, you can get the summary of all these in a separate worksheet.

Go to Analyze > Fields, Items, & Sets –> List Formulas.

Advanced Formula in Calculated Field 5

It will give you a summary of all the formulas in a new worksheet.

Advanced Formula in Calculated Field 6

Things to Remember About Pivot Table Formula in Excel 

  • We can delete, modify all the calculated fields.
  • We cannot use formulas like VLOOKUP, SUMIF, and many other ranges involved formulas in calculated fields, i.e. all the formulas which require range cannot be used.

Recommended Articles

This has been a guide to Pivot Table Formula in Excel. Here we discussed the Steps to Use Formula of Pivot Table in Excel along with Examples and downloadable excel template. You may also look at these useful functions in excel –

  1. Pivot Table in Excel
  2. Excel Delete Pivot Table
  3. VBA Pivot Table
  4. VBA Refresh Pivot Table

Skip to content

Как сделать сводную таблицу в Excel – пошаговая инструкция для чайников

В этом руководстве вы узнаете, что такое сводная таблица, и найдете подробную инструкцию, как по шагам создавать и использовать её в Excel.

Если вы работаете с большими наборами данных в Excel, то сводная таблица очень удобна для быстрого создания интерактивного представления из множества записей. Помимо прочего, она может автоматически сортировать и фильтровать информацию, подсчитывать итоги, вычислять среднее значение, а также создавать перекрестные таблицы. Это позволяет взглянуть на ваши цифры совершенно с новой стороны.

Важно также и то, что при этом ваши исходные данные не затрагиваются – что бы вы не делали с вашей сводной таблицей. Вы просто выбираете такой способ отображения, который позволит вам увидеть новые закономерности и связи. Ваши показатели будут разделены на группы, а огромный объем информации будет представлен в понятной и доступной для анализа форме.

  1. Что такое сводная таблица?
  2. Как создать сводную таблицу.
    • 1. Организуйте свои исходные данные
    • 2. Создаем и размещаем макет
    • 3. Как добавить поле
    • 4. Как удалить поле из сводной таблицы?
    • 5. Как упорядочить поля?
    • 6. Выберите функцию для значений (необязательно)
    • 7. Используем различные вычисления в полях значения (необязательно)
  3. Работа со списком показателей сводной таблицы
  4. Закрытие и открытие панели редактирования.
  5. Воспользуйтесь рекомендациями программы.
  6. Давайте улучшим результат.
  7. Как обновить сводную таблицу.
  8. Как переместить на новое место?
  9. Как удалить сводную таблицу?

Что такое сводная таблица?

Это инструмент для изучения и обобщения больших объемов данных, анализа связанных итогов и представления отчетов. Они помогут вам:

  • представить большие объемы данных в удобной для пользователя форме.
  • группировать информацию по категориям и подкатегориям.
  • фильтровать, сортировать и условно форматировать различные сведения, чтобы вы могли сосредоточиться на самом актуальном.
  • поменять строки и столбцы местами.
  • рассчитать различные виды итогов.
  • разворачивать и сворачивать уровни данных, чтобы узнать подробности.
  • представить в Интернете сжатые и привлекательные таблицы или печатные отчеты.

Например, у вас множество записей в электронной таблице с цифрами продаж шоколада:

И каждый день сюда добавляются все новые сведения. Одним из возможных способов суммирования этого длинного списка чисел по одному или нескольким условиям является использование формул, как было продемонстрировано в руководствах по функциям СУММЕСЛИ и СУММЕСЛИМН. 

Однако, когда вы хотите сравнить несколько показателей по каждому продавцу либо по отдельным товарам, использование сводных таблиц является гораздо более эффективным способом. Ведь при использовании функций вам придется писать много формул с достаточно сложными условиями. А здесь всего за несколько щелчков мыши вы можете получить гибкую и легко настраиваемую форму, которая суммирует ваши цифры как вам необходимо.

Вот посмотрите сами.

Этот скриншот демонстрирует лишь несколько из множества возможных вариантов анализа продаж. И далее мы рассмотрим примеры построения сводных таблиц в Excel 2016, 2013, 2010 и 2007.

Как создать сводную таблицу.

Многие думают, что создание отчетов при помощи сводных таблиц для «чайников» является сложным и трудоемким процессом. Но это не так! Microsoft много лет совершенствовала эту технологию, и в современных версиях Эксель они очень удобны и невероятно быстры. 

Фактически, вы можете сделать это всего за пару минут. Для вас – небольшой самоучитель в виде пошаговой инструкции:

1. Организуйте свои исходные данные

Перед созданием сводного отчета организуйте свои данные в строки и столбцы, а затем преобразуйте диапазон данных в таблицу. Для этого выделите все используемые ячейки, перейдите на вкладку меню «Главная» и нажмите «Форматировать как таблицу».

Использование «умной» таблицы в качестве исходных данных дает вам очень хорошее преимущество — ваш диапазон данных становится «динамическим». Это означает, что он будет автоматически расширяться или уменьшаться при добавлении или удалении записей. Поэтому вам не придется беспокоиться о том, что в свод не попала самая свежая информация.

Полезные советы:

  • Добавьте уникальные, значимые заголовки в столбцы, они позже превратятся в имена полей.
  • Убедитесь, что исходная таблица не содержит пустых строк или столбцов и промежуточных итогов.
  • Чтобы упростить работу, вы можете присвоить исходной таблице уникальное имя, введя его в поле «Имя» в верхнем правом углу.

2. Создаем и размещаем макет

Выберите любую ячейку в исходных данных, а затем перейдите на вкладку Вставка > Сводная таблица .

Откроется окно «Создание ….. ». Убедитесь, что в поле  Диапазон указан правильный источник данных. Затем выберите местоположение для свода:

  • Выбор нового рабочего листа поместит его на новый лист, начиная с ячейки A1.
  • Выбор существующего листа разместит в указанном вами месте на существующем листе. В поле «Диапазон» выберите первую ячейку (то есть, верхнюю левую), в которую вы хотите поместить свою таблицу.

Нажатие ОК создает пустой макет без цифр в целевом местоположении, который будет выглядеть примерно так:

Полезные советы:

  • В большинстве случаев имеет смысл размещать на отдельном рабочем листе. Это особенно рекомендуется для начинающих.
  • Ежели вы берете информацию из другой таблицы или рабочей книги, включите их имена, используя следующий синтаксис: [workbook_name]sheet_name!Range. Например, [Книга1.xlsx] Лист1!$A$1:$E$50. Конечно, вы можете не писать это все руками, а просто выбрать диапазон ячеек в другой книге с помощью мыши.
  • Возможно, было бы полезно построить таблицу и диаграмму одновременно. Для этого в Excel 2016 и 2013 перейдите на вкладку «Вставка», щелкните стрелку под кнопкой «Сводная диаграмма», а затем нажмите «Диаграмма и таблица». В версиях 2010 и 2007 щелкните стрелку под сводной таблицей, а затем — Сводная диаграмма.
  1. Организация макета.

Область, в которой вы работаете с полями макета, называется списком полей. Он расположен в правой части рабочего листа и разделен на заголовок и основной раздел:

  • Раздел «Поле» содержит названия показателей, которые вы можете добавить. Они соответствуют именам столбцов исходных данных.
  • Раздел «Макет» содержит область «Фильтры», «Столбцы», «Строки» и «Значения». Здесь вы можете расположить в нужном порядке поля.

Изменения, которые вы вносите в этих разделах, немедленно применяются в вашей таблице.

3. Как добавить поле

Чтобы иметь возможность добавить поле в нужную область, установите флажок рядом с его именем.

По умолчанию Microsoft Excel добавляет поля в раздел «Макет» следующим образом:

  • Нечисловые добавляются в область Строки;
  • Числовые добавляются в область значений;
  • Дата и время добавляются в область Столбцы.

4. Как удалить поле из сводной таблицы?

Чтобы удалить любое поле, вы можете выполнить следующее:

  • Снимите флажок напротив него, который вы ранее установили.
  • Щелкните правой кнопкой мыши поле и выберите «Удалить……».

И еще один простой и наглядный способ удаления поля. Перейдите в макет таблицы, зацепите мышкой ненужный вам элемент и перетащите его за пределы макета. Как только вы вытащите его за рамки, рядом со значком появится хатактерный крестик. Отпускайте кнопку мыши и наблюдайте, как внешний вид вашей таблицы сразу же изменится.

5. Как упорядочить поля?

Вы можете изменить расположение показателей тремя способами:

  1. Перетащите поле между 4 областями раздела с помощью мыши. В качестве альтернативы щелкните и удерживайте его имя в разделе «Поле», а затем перетащите в нужную область в разделе «Макет». Это приведет к удалению из текущей области и его размещению в новом месте.

  1. Щелкните правой кнопкой мыши имя в разделе «Поле» и выберите область, в которую вы хотите добавить его:

  1. Нажмите на поле в разделе «Макет», чтобы выбрать его. Это сразу отобразит доступные параметры:

Все внесенные вами изменения применяются немедленно.

Ну а ежели спохватились, что сделали что-то не так, не забывайте, что есть «волшебная» комбинация клавиш CTRL+Z, которая отменяет сделанные вами изменения (если вы не сохранили их, нажав соответствующую клавишу).

6. Выберите функцию для значений (необязательно)

По умолчанию Microsoft Excel использует функцию «Сумма» для числовых показателей, которые вы помещаете в область «Значения». Когда вы помещаете нечисловые (текст, дата или логическое значение) или пустые значения в эту область, к ним применяется функция «Количество».

Но, конечно, вы можете выбрать другой метод расчёта. Щелкните правой кнопкой мыши поле значения, которое вы хотите изменить, выберите Параметры поля значений и затем — нужную функцию.

Думаю, названия операций говорят сами за себя, и дополнительные пояснения здесь не нужны. В крайнем случае, попробуйте различные варианты сами.

Здесь же вы можете изменить имя его на более приятное и понятное для вас. Ведь оно отображается в таблице, и поэтому должно выглядеть соответственно.

В Excel 2010 и ниже опция «Суммировать значения по» также доступна на ленте — на вкладке «Параметры» в группе «Расчеты».

7. Используем различные вычисления в полях значения (необязательно)

Еще одна полезная функция позволяет представлять значения различными способами, например, отображать итоговые значения в процентах или значениях ранга от наименьшего к наибольшему и наоборот. Полный список вариантов расчета доступен здесь .

Это называется «Дополнительные вычисления». Доступ к ним можно получить, открыв вкладку «Параметры …», как это описано чуть выше.

Подсказка. Функция «Дополнительные вычисления» может оказаться особенно полезной, когда вы добавляете одно и то же поле более одного раза и показываете, как в нашем примере, общий объем продаж и объем продаж в процентах от общего количества одновременно. Согласитесь, обычными формулами делать такую таблицу придется долго. А тут – пара минут работы!

Итак, процесс создания завершен. Теперь пришло время немного поэкспериментировать, чтобы выбрать макет, наиболее подходящий для вашего набора данных.

Работа со списком показателей сводной таблицы

Панель, которая формально называется списком полей, является основным инструментом, который используется для упорядочения таблицы в соответствии с вашими требованиями. Вы можете настроить её по своему вкусу, чтобы удобнее .

Чтобы изменить способ отображения вашей рабочей области, нажмите кнопку «Инструменты» и выберите предпочитаемый макет.

Вы также можете изменить размер панели по горизонтали, перетаскивая разделитель, который отделяет панель от листа.

Закрытие и открытие панели редактирования.

Закрыть список полей в сводной таблице так же просто, как нажать кнопку «Закрыть» (X) в верхнем правом углу панели. А вот как заставить его появиться снова – уже не так очевидно :)

Чтобы снова отобразить его, щелкните правой кнопкой мыши в любом месте таблицы и выберите «Показать …» в контекстном меню.

Также можно нажать кнопку «Список полей» на ленте, которая находится на вкладке меню «Анализ».

Воспользуйтесь рекомендациями программы.

Как вы только что видели, создание сводных таблиц — довольно простое дело, даже для «чайников». Однако Microsoft делает еще один шаг вперед и предлагает автоматически сгенерировать отчет, наиболее подходящий для ваших исходных данных. Все, что вам нужно, это 4 щелчка мыши:

  1. Нажмите любую ячейку в исходном диапазоне ячеек или таблицы.
  2. На вкладке «Вставка» выберите «Рекомендуемые сводные таблицы». Программа немедленно отобразит несколько макетов, основанных на ваших данных.
  3. Щелкните на любом макете, чтобы увидеть его предварительный просмотр.
  4. Если вас устраивает предложение, нажмите кнопку «ОК» и добавьте понравившийся вариант на новый лист.

Как вы видите на скриншоте выше, Эксель смог предложить несколько базовых макетов для моих исходных данных, которые значительно уступают сводным таблицам, которые мы создали вручную несколько минут назад. Конечно, это только мое мнение :)

Но при всем при этом, использование рекомендаций — это быстрый способ начать работу, особенно когда у вас много данных и вы не знаете, с чего начать. А затем этот вариант можно легко изменить по вашему вкусу.

Давайте улучшим результат.

Теперь, когда вы знакомы с основами, вы можете перейти к вкладкам «Анализ» и «Конструктор» инструментов в Excel 2016 и 2013 ( вкладки « Параметры» и « Конструктор» в 2010 и 2007). Они появляются, как только вы щелкаете в любом месте таблицы.

Вы также можете получить доступ к параметрам и функциям, доступным для определенного элемента, щелкнув его правой кнопкой мыши (об этом мы уже говорили при создании).

После того, как вы построили таблицу на основе исходных данных, вы, возможно, захотите уточнить ее, чтобы провести более серьёзный анализ.

Чтобы улучшить дизайн, перейдите на вкладку «Конструктор», где вы найдете множество предопределенных стилей. Чтобы получить свой собственный стиль, нажмите кнопку «Создать стиль….» внизу галереи «Стили сводной таблицы».

Чтобы настроить макет определенного поля, щелкните на нем, затем нажмите кнопку «Параметры» на вкладке «Анализ» в Excel 2016 и 2013 (вкладка « Параметры» в 2010 и 2007). Также вы можете щелкнуть правой кнопкой мыши поле и выбрать «Параметры … » в контекстном меню.

На снимке экрана ниже показан новый дизайн и макет.

Я изменил цветовой макет, а также постарался, чтобы таблица была более компактной. Для этого поменяем параметры представления товара. Какие параметры я использовал – вы видите на скриншоте.

Думаю, стало даже лучше. 😊

Как избавиться от заголовков «Метки строк» ​​и «Метки столбцов».

При создании сводной таблицы, Excel применяет Сжатую форму по умолчанию. Этот макет отображает «Метки строк» и «Метки столбцов» в качестве заголовков. Согласитесь, это не очень информативно, особенно для новичков.

Простой способ избавиться от этих нелепых заголовков — перейти с сжатого макета на структурный или табличный. Для этого откройте вкладку «Конструктор», щелкните раскрывающийся список «Макет отчета» и выберите « Показать в форме структуры» или « Показать в табличной форме» .

И вот что мы получим в результате.

Показаны реальные имена, как вы видите на рисунке справа, что имеет гораздо больше смысла.

Другое решение — перейти на вкладку «Анализ», нажать кнопку «Заголовки полей», выключить их. Однако это удалит не только все заголовки, а также выпадающие фильтры и возможность сортировки. А для анализа данных отсутствие фильтров – это чаще всего нехорошо.

Как обновить сводную таблицу.

Хотя отчет связан с исходными данными, вы можете быть удивлены, узнав, что Excel не обновляет его автоматически. Это можно считать небольшим недостатком. Вы можете обновить его, выполнив операцию обновления вручную или же это произойдет автоматически при открытии файла.

Как обновить вручную.

  1. Нажмите в любом месте на свод.
  2. На вкладке «Анализ» нажмите кнопку «Обновить» или же нажмите клавиши ALT + F5.

Кроме того, вы можете по щелчку правой кнопки мыши выбрать пункт Обновить из появившегося контекстного меню.

Чтобы обновить все сводные таблицы в файле, нажмите стрелку кнопки «Обновить», а затем  —  «Обновить все».

Примечание. Если внешний вид вашей сводной таблицы сильно изменяется после обновления, проверьте параметры «Автоматически изменять ширину столбцов при обновлении» и « Сохранить форматирование ячейки при обновлении». Чтобы сделать это, откройте «Параметры сводной таблицы», как это показано на рисунке, и вы найдете там эти флажки.

После запуска обновления вы можете просмотреть статус или отменить его, если вы передумали. Просто нажмите на стрелку кнопки «Обновить», а затем — «Состояние обновления» или «Отменить обновление».

Автоматическое обновление сводной таблицы при открытии файла.

  1. Откройте вкладку параметров, как это мы только что делали.
  2. В диалоговом окне «Параметры … » перейдите на вкладку «Данные» и установите флажок «Обновить при открытии файла».

Как переместить на новое место?

Может быть вы захотите переместить своё творение в новую рабочую книгу? Перейдите на вкладку «Анализ», нажмите кнопку «Действия» и затем — «Переместить ….. ». Выберите новый пункт назначения и нажмите ОК.

Как удалить сводную таблицу?

Если вам больше не нужен определенный сводный отчет, вы можете удалить его несколькими способами.

  • Если таблица находится на отдельном листе, просто удалите этот лист.
  • Ежели она расположена вместе с некоторыми другими данными на листе, выделите всю её с помощью мыши и нажмите клавишу Delete.
  • Щелкните в любом месте в сводной таблице, которую хотите удалить, перейдите на вкладку «Анализ» (см. скриншот выше) => группа «Действия», нажмите небольшую стрелку под кнопкой «Выделить», выберите «Вся сводная таблица», а затем нажмите Удалить.

Примечание. Если у вас есть какая-либо диаграмма, построенная на основе свода, то описанная выше процедура удаления превратит ее в стандартную диаграмму, которую больше нельзя будет изменять или обновлять.

Надеемся, что этот самоучитель станет для вас хорошей отправной точкой.  Далее нас ждут еще несколько рекомендаций, как работать со сводными таблицами. И спасибо за чтение!

Возможно, вам также будет полезно:

Home / Pivot Table / Formulas in a Pivot Table (Calculated Fields & Items)

One of the best ways to become an advanced pivot table user and use Excel for data analysis is by using calculated items and calculated fields in a pivot table.

Using formulas in a pivot table or custom calculation which don’t exist in the source data but work like other fields.

In simple words, these are the calculations within the pivot table. In the below example, you can see a pivot table with a calculated field which is calculating the average selling price. On the other hand, source data doesn’t have any type of field like this.

insert calculation in pivot table

Pivot Tables are one of the INTERMEDIATE EXCEL SKILLS.

In the Excel pivot table, the calculated field is like all other fields of your pivot table, but they don’t exist in the source data. But, they are created by using formulas in the pivot table. Follow these simple steps to insert the calculated field in a pivot table.

  1. First of all, you need a simple pivot table to add a Calculated Field.
    insert-calculation-in-pivot-table-2
  2. Just click on any of the fields in your pivot table. You will see a pivot table option in your ribbon which further having further two options (Analyze & Design) Click on the analyze option, then on Fields, Items, & Sets. You will further get a list of options, just click on the calculated field.
    insert-calculation-in-pivot-table-3
  3. After clicking the calculated field, you will get a pop-up menu, just like below. This popup menu comes with two input options (name & formula) & a selection option.
    insert-calculation-in-pivot-table-4
  4. Name: Name of the calculated Field which will show in your pivot table.
  5. Formula: An input option to insert formula for calculated field.
  6. Fields: A drop down option to select other fields from source data to calculate a new field.

Calculated Items in a Pivot Table

Calculated items are like all other items of your pivot table, but the difference is that they are not in existence in your source data. They are just created by using a formula. You can edit, change or delete calculated Items as per your requirement.

  1. Just click on any of the items in your pivot table. You will see a pivot table option on your ribbon having further two options (Analyze & Design).
  2. Click on the Analyze, then on Fields, Items, & Sets.
  3. You will further get a list of options, just click on Calculated Item.
    insert-calculation-in-pivot-table-7
  4. After clicking the calculated item, you will get a pop-up menu, just like above. This popup menu comes with two input options (Name & Formula) & two selection options (Field & Items).
  5. We had already discussed “Name, Formula & Fields” in calculated fields.
  6. Items: To select the items for calculation.
  7. In this example, we are going to calculate the average selling price and, the formula will be = amount/quantity.
  8. In Fields option, select Amount & click on insert, then insert “/” division operator & insert quantity after that.
  9. Press OK.
  10. Now a new Field appears in your Pivot Table.
    insert-calculation-in-pivot-table-5
  11. Your new calculated field is created without any number format.
    insert-calculation-in-pivot-table-6

In this example, we are going to calculate the average for the first half of the year & for the 2nd half of the year. We just have to add the formula.

=average(jan, feb, mar, apr, may, jun)

Now you have to calculate items in your pivot, showing an average of the first six months and the second six months of the year.

Insert a Calculated Item To Add Calculation In Pivot Table

But wait a minute. What is this? Grand total is changed from 1506 & $311820 to 1746 & $361600.

Inserted Calculated Item To Insert Calculation In Pivot Table

The reason behind this is, pivot table totals & subtotals include your calculated fields while the calculation of total and sub-total. So you need to filter your calculated items if you want to show the actual picture.

Things To Remember

  • Don’t forget to remove 0 from the formula input option while inserting a formula for calculation
  • You can only able to use formulas that don’t require cell references.
  • You have to check whether calculated items are affecting your pivot results (Sub Totals and Grand Totals).
  • Adjust the solve order are per your calculation requirement.

The Pivot Table is a powerful tool for Microsoft Excel. With its help the user analyzes large ranges and sums up just in a few clicks. He can display only the information that he need at this very moment.



Filter in the Excel Pivot Table

You can convert almost any range of data in the Pivot Table: the results of financial transactions, information about suppliers and buyers, the home library catalog, etc.

For example, take the following table:

Data for.

We will create a summary table: «INSERT» — «PivotTable». Put it on a new sheet.

INSERT.

We added information about suppliers including quantity and cost. Now it’s in our consolidated report.

Let’s remind how the summary report dialog box looks like:

report dialog box.

We set the program instructions to generate a summary report while dragging the headers. If you accidentally make an error, you can delete the header from the bottom area or replace it with another one.

summary report.

Totals appears according to the data which are placed in the field «Values». In automatic mode it’s the sum. But you can set «average», «maximum», etc. If you need to do this for the values of the entire field, then click on the name of the column and change the way the totals are presented:

change.

For example, the average number of orders for each supplier:

average number.

Results can be changed not in all columns but only in a separate cell. Then we right-click on this cell.

Set the filter in the summary report:

  1. Put a tick in front of the «Stock» header in the list of fields to add to the table filters we need.
  2. filters we need.

  3. Drag this field to the «FILTERS» area.
  4. FILTERS.

  5. The table became three-dimensional and the «Stock» tag turn up at the top.

Stock.

Now we can filter the values in the report by warehouse number. Click on the arrow in the right corner of the cell and select the items we are interested in:

items we are interested.

For example, «1»:

For example.

The report displays information only for the first warehouse. We see above the value and the icon of the filter.

report displays information.

You can also filter the report using the values in the first column.



Sorting in the Excel Pivot Table

Let’s transform our consolidated report: we will remove the value «Suppliers» and add the «Date» tag.

Let’s make the table more useful. We will group the dates by quarters. To do this right-click on any cell with a date. In the drop-down menu select «Group». Fill in the grouping parameters:

drop-down menu.

The Pivot Table takes the following form after clicking OK:

Pivot Table takes.

Let’s sort the data in the report by the value of the column «Amount». Click the right mouse button on any cell or column name. Select «Sort» and sorting method.

sorting method.

The values in the summary report will be changed according to the sorted data:

sorted data.

Now let’s sort the data by date. Click right mouse button and choose «Sort». You can select the sorting method and stop with this step. But we will follow an otherwise pathway. Click «More Sort Options»-«More Options…». A window like this will open:

More Options.

Let’s set sorting parameters: «Sort Date in descending order». Click on the «More Options» button. Put a checkmark next to «AutoSort»-«Sort automatically every time the report is updated».

Now Excel will sort dates in descending order (from new to old) when the new dates will appear in the Pivot Table:

new dates.

Formulas in Excel Pivot Table

Firstly, we will compile a consolidated report, where the totals will be presented not only by the sum. Let’s start from scratch with an empty table. For one we learn how to add a column in the Pivot Table.

  1. Add the «Provider» header to the report. We will drag «Amount» header for three times in the «Value» field. Now three identical columns will be added to the Pivot Table.
  2. Amount.

  3. Leave the value «Sum» for totals in the first column. For the second one choose «Average». For the third one set «Count».
  4. Count.

  5. We swap column values and row values. «Provider» goes to the column names. «Σ values» goes to the lines names.

swap column.

The consolidated report became more convenient for perception:

perception.

Let’s study how to prescribe formulas in a summary table. Click on any cell in the report to activate the «PIVOTTABLE TOOLS» tool.

PIVOTTABLE TOOLS.

On the «ANALYZE» tab we select «Fields, Items and Sets» — «Calculated Field».

Calculated Field.

Click and a dialog box opens. Enter the name of the calculated area and the formula to find the values.

formula.

We get the added additional column with the result of calculations using the formula.

Done.

Download Pivot Table example

Make an experiments: summary table tools are hothouse. You can always delete the unsuccessful version and redo it If something does not work out.

Понравилась статья? Поделить с друзьями:
  • Forms of the word lead
  • Formula for multiplying in excel
  • Forms of the word language
  • Formula for indexing in excel
  • Forms of the word imagine