Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 30

Creating Pivot Table

Insert a Pivot Table

To insert a pivot table, execute the following steps.

1. Click any single cell inside the data set.

2. On the Insert tab, in the Tables group, click PivotTable.

The following dialog box appears. Excel automatically selects the data for you. The default
location for a new pivot table is New Worksheet.

3. Click OK.

Drag fields

The PivotTable Fields pane appears. To get the total amount exported of each product, drag the
following fields to the different areas.
1. Product field to the Rows area.

2. Amount field to the Values area.

3. Country field to the Filters area.

Below you can find the pivot table. Bananas are our main export product. That's how easy pivot
tables can be!
Sort

To get Banana at the top of the list, sort the pivot table.

1. Click any cell inside the Sum of Amount column.

2. Right click and click on Sort, Sort Largest to Smallest.

Result.
Filter

Because we added the Country field to the Filters area, we can filter this pivot table by Country.
For example, which products do we export the most to France?

1. Click the filter drop-down and select France.

Result. Apples are our main export product to France.

Note: you can use the standard filter (triangle next to Row Labels) to only show the amounts of
specific products.

Change Summary Calculation

By default, Excel summarizes your data by either summing or counting the items. To change the
type of calculation that you want to use, execute the following steps.
1. Click any cell inside the Sum of Amount column.

2. Right click and click on Value Field Settings.

3. Choose the type of calculation you want to use. For example, click Count.

4. Click OK.

Result. 16 out of the 28 orders to France were 'Apple' orders.


Two-dimensional Pivot Table

If you drag a field to the Rows area and Columns area, you can create a two-dimensional pivot
table. First, insert a pivot table. Next, to get the total amount exported to each country, of each
product, drag the following fields to the different areas.

1. Country field to the Rows area.

2. Product field to the Columns area.

3. Amount field to the Values area.

4. Category field to the Filters area.


Below you can find the two-dimensional pivot table.
To easily compare these numbers, create a pivot chart and apply a filter. Maybe this is one step
too far for you at this stage, but it shows you one of the many other powerful pivot table features
Excel has to offer.

*************************************************************************************
How to Edit a Calculated Field in the Pivot Table?
Share on Facebook Share on Twitter

Share

Is the pivot table doesn’t allow you to edit the data? Not able to add, modify, or delete your
field? Do you have any idea about the calculated field? Then this article will help you to know
about the calculated field option in the pivot table to solve this problem. Let’s discuss it now.

Insert a Calculated Field in the Pivot Table

Calculated Field option in the pivot table will help you to add, modify, or delete your field in
Excel. If you add a field using a calculated field then you can edit only that field.

Example: Here I have a list of salesperson details, now I want to add the field in the pivot table
to offer the bonus for each employee. Follow the below steps to insert a calculated field in the
pivot table.

Step 1: The first step is to create a pivot table for the data.
To know how to create a Pivot table please Click Here.
Step 2: To add a field, Tick the checkbox before the field name in the PivotTable Fields panel.
When you select the field name, the selected field name will be inserted into the pivot table.

Pro Tip. Row or Column Labels are used to apply a filter to rows or columns that have to be
shown in the pivot table. By default, it will show you the sum or count values in the pivot table.

Step 3: Once you insert the field into the pivot table, click on any cell in the pivot table and go to
Analyze > Fields, Items, & Sets > Calculated Field.
Step 4: An Insert Calculated Field appears in the window.
Step 5: Enter the field name you want and enter the formula you want to calculate either by
typing in the Formula textbox or by selecting the field name in the Fields list box and click OK.
Here I have entered the field name as “Bonus” and typed the formula using the “Salary ( in Rs. )”
field by calculating it by 2 percent to offer the bonus.

Step 6: Once you click OK, a field will be inserted into the pivot table.

Note. In the PivotTable Fields panel, the newly inserted field will be stored in it. Here you can
see the “Bonus” field in the PivotTable Fields panel.

*************************************************************************************
PivotTable Layout Options

1. Click any cell inside the PivotTable.

The Analyze and Design tabs appear under PivotTable Tools on the ribbon.

2. Click the Design tab on the ribbon.

The Layout group has options to change which elements appear in your PivotTable.

o Subtotals: Click to show or hide subtotals, and to specify where to show them.
o Grand Totals: Click to show or hide grand totals, and to specify whether they
appear for rows, columns, or both.
o Report Layout: Show the PivotTable in compact, outline, or tabular form.
o Blank Rows: Insert or remove a blank line between each grouped item in the
PivotTable.
3. Click the Layout button for the element you want to update.

A list of options appears, depending on the button that was selected.

4. Select an option from the list.


The PivotTable layout is updated based on your selection

*************************************************************************************
Pivot Table Formatting

After creating a PivotTable, you may want to enhance the look of it using styles. By default, the
column headings, grand total row, and any filters have a light shading applied to the cells based
on the workbook’s theme colors. However, if you don’t like these, there are a variety of other
styles to choose from.

Work with Style Options

You can select PivotTable style options that allow you to adjust the format for part of a
PivotTable. For example, you can apply special formatting to row headers or make the columns
banded.

1. Click any cell in the PivotTable.


2. Click the Design tab.
3. Select an option from the PivotTable Style Options group.
o Row/Column Headers: Displays special formatting for the first row or column
of the PivotTable.
o Banded Rows/Columns: Applies a different format to alternate rows or columns.
Apply a Built-In Style

Excel also has a gallery of built-in styles you can choose from to quickly format a PivotTable.

1. On the Design tab, select an option in the Styles gallery.


The PivotTable Styles group will show a few table styles, but to see the rest, you’ll need
to expand the gallery.

The style is applied to the table, changing the borders, shading, and colors.

*************************************************************************************
Pivot Chart

Insert Pivot Chart | Filter Pivot Chart | Change Pivot Chart Type

A pivot chart is the visual representation of a pivot table in Excel. Pivot charts and pivot tables
are connected with each other.

Below you can find a two-dimensional pivot table. Go back to Pivot Tables to learn how to
create this pivot table.

Insert Pivot Chart

To insert a pivot chart, execute the following steps.

1. Click any cell inside the pivot table.

2. On the PivotTable Analyze tab, in the Tools group, click PivotChart.

The Insert Chart dialog box appears.


3. Click OK.

Below you can find the pivot chart. This pivot chart will amaze and impress your boss.

Note: any changes you make to the pivot chart are immediately reflected in the pivot table and
vice versa.

Filter Pivot Chart

To filter this pivot chart, execute the following steps.

1. Use the standard filters (triangles next to Product and Country). For example, use the Country
filter to only show the total amount of each product exported to the United States.
2. Remove the Country filter.

3. Because we added the Category field to the Filters area, we can filter this pivot chart (and
pivot table) by Category. For example, use the Category filter to only show the vegetables
exported to each country.

Change Pivot Chart Type

You can change to a different type of pivot chart at any time.

1. Select the chart.

2. On the Design tab, in the Type group, click Change Chart Type.

3. Choose Pie.
4. Click OK.

Result:
Note: pie charts always use one data series (in this case, Beans). To get a pivot chart of a
country, swap the data over the axis. First, select the chart. Next, on the Design tab, in the Data
group, click

*************************************************************************************
Prompting User Input in Excel

You can use the InputBox function in Excel VBA to prompt the user to enter a value. Place a
command button on your worksheet and add the following code lines:

1. First, declare the variable myValue of type Variant.

Dim myValue As Variant

Note: we use a variable of type Variant here because a Variant variable can hold any type of
value. This way the user can enter text, numbers, etc.

2. Add the following code line to show the input box.

myValue = InputBox("Give me some input")

3. Write the value of myValue to cell A1.

Range("A1").Value = myValue

Result when the user enters the value 5 and clicks the OK button.

4. The InputBox function has more optional arguments. The following code line shows an input
box with a title displayed in the title bar and has a default value. The default value will be used if
no other input is provided.

myValue = InputBox("Give me some input", "Hi", 1)


Result when the user only clicks the OK button.

Note: Place your cursor on InputBox in the Visual Basic Editor and click F1 for help on the other
optional arguments.

*************************************************************************************
How to Use the IF-THEN Function in Excel

 The syntax of IF-THEN is =IF(logic test,value if true,value if false).


 The first argument tells the function what to do if the comparison is true.
 The second argument tells the function what to do if the comparison is false.

This article explains how to use the IF-THEN function in Excel for Microsoft 365, Excel 2019,
2016, 2013, 2010; Excel for Mac, and Excel Online, as well as a few examples.

Inputting IF-THEN in Excel

The IF-THEN function in Excel is a powerful way to add decision making to your spreadsheets.
It tests a condition to see if it's true or false and then carries out a specific set of instructions
based on the results.

For example, by inputting an IF-THEN in Excel, you can test if a specific cell is greater than
900. If it is, you can make the formula return the text "PERFECT." If it isn't, you can make the
formula return "TOO SMALL."

There are many conditions you can enter into the IF-THEN formula.

The IF-THEN function's syntax includes the name of the function and the function arguments
inside of the parenthesis.

This is the proper syntax of the IF-THEN function:

=IF(logic test,value if true,value if false)

The IF part of the function is the logic test. This is where you use comparison operators to
compare two values.

The THEN part of the function comes after the first comma and includes two arguments
separated by a comma.

 The first argument tells the function what to do if the comparison is true.
 The second argument tells the function what to do if the comparison is false.

A Simple IF-THEN Function Example

Before moving on to more complex calculations, let's look at a straightforward example of an IF-
THEN statement.
Our spreadsheet is set up with cell B2 as $100. We can input the following formula into C2 to
indicate whether the value is larger than $1000.

=IF(B2>1000,"PERFECT","TOO SMALL")

This function has the following arguments:

 B2>1000 tests whether the value in cell B2 is larger than 1000.


 "PERFECT" returns the word PERFECT in cell C2 if B2 is larger than 1000.
 "TOO SMALL" returns the phrase TOO SMALL in cell C2 if B2 is not larger than 1000.

The comparison part of the function can compare only two values. Either of those two values can
be:

 Fixed number
 A string of characters (text value)
 Date or time
 Functions that return any of the values above
 A reference to any other cell in the spreadsheet containing any of the above values

The TRUE or FALSE part of the function can also return any of the above. This means that you
can make the IF-THEN function very advanced by embedding additional calculations or
functions inside of it (see below).

When inputting true or false conditions of an IF-THEN statement in Excel, you need to use
quotation marks around any text you want to return, unless you're using TRUE and FALSE,
which Excel automatically recognizes. Other values and formulas don't require quotation marks.

Inputting Calculations Into the IF-THEN Function

You can embed different calculations for the IF-THEN function to perform, depending on the
comparison results.

In this example, one calculation is used to calculate the tax owed, depending on the total income
in B2.

The logic test compares total income in B2 to see if it's greater than $50,000.00.

=IF(B2>50000,B2*0.15,B2*0.10)

In this example, B2 is not larger than 50,000, so the "value_if_false" condition will calculate and
return that result.

In this case, that's B2*0.10, which is 4000.

The result is placed into cell C2, where the IF-THEN function is inserted, will be 4000.
You can also embed calculations into the comparison side of the function.

For example, if you want to estimate that taxable income will only be 80% of total income, you
could change the above IF-THEN function to the following.

=IF(B2*0.8>50000,B2*0.15,B2*0.10)

This will perform the calculation on B2 before comparing it to 50,000.

*************************************************************************************

You might also like