Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Managing Connections
Creating Links
Managing Rules
Using IF Functions
Nesting IF Functions
Applying Sharing
Creating PivotChart
The IF function checks whether a condition is met, and returns one value if TRUE and another value if FALSE.
1. Select cell C1 and enter the following function.
The IF function returns Correct because the value in cell A1 is higher than 10.
Nesting IF Functions
The IF function in Excel can be nested, when you have multiple conditions to meet. The FALSE value is being
replaced by another IF function to make a further test.
Note: if you have Excel 2016, simply use the IFS function.
1a. If cell A1 equals 1, the formula returns Bad.
2b. If cell A1 is greater than 10 and less or equal to 20, the formula returns 700.
2c. If cell A1 is greater than 20 and less or equal to 30, the formula returns 1400.
IFS Function
Use the IFS function in Excel 2016 when you have multiple conditions to meet. The IFS function returns a value
corresponding to the first TRUE condition.
Note: if you don't have Excel 2016, you can nest the IF function.
1a. If cell A1 equals 1, the IFS function returns Bad.
1d. If cell A1 equals another value, the IFS function returns No Valid Score.
Note: instead of TRUE, you can also use 1=1 or something else that is always TRUE.
2c. If cell A1 is greater than 20 and less or equal to 30, the IFS function returns 1400.
2d. If cell A1 is greater than 30, the IFS function returns 2000.
Note: to slightly change the boundaries, you might want to use "<" instead of "<=" in your own function.
And Function
The AND Function returns TRUE if all conditions are true and returns FALSE if any of the conditions are false.
1. Select cell D1 and enter the following formula.
The AND function returns FALSE because the value in cell B1 is not higher than 5. As a result the IF function
returns Incorrect.
Or Function
The OR function returns TRUE if any of the conditions are TRUE and returns FALSE if all conditions are false.
1. Select cell E1 and enter the following formula.
The OR function returns TRUE because the value in cell A1 is higher than 10. As a result the IF function returns
Correct.
General note: the AND and OR function can check up to 255 conditions.
VLookup
The VLOOKUP (Vertical lookup) function looks for a value in the leftmost column of a table, and then returns a
value in the same row from another column you specify.
Explanation: the VLOOKUP function looks for the ID (104) in the leftmost column of the range $E$4:$G$7 and
returns the value in the same row from the third column (third argument is set to 3). The fourth argument is set to
FALSE to return an exact match or a #N/A error if not found.
HLookup
In a similar way, you can use the HLOOKUP (Horizontal lookup) function.
Match
The MATCH function returns the position of a value in a given range.
Explanation: Yellow found at position 3 in the range E4:E7. The third argument is optional. Set this argument to 0
to return the position of the value that is exactly equal to lookup_value (A2) or a #N/A error if not found.
Index
The INDEX function below returns a specific value in a two-dimensional range.
Explanation: 92 found at the intersection of row 3 and column 2 in the range E4:F7.
Count
To count the number of cells that contain numbers, use the COUNT function.
Countif
To count cells based on one criteria (for example, higher than 9), use the following COUNTIF function.
Countifs
To count cells based on multiple criteria (for example, green and higher than 9), use the following COUNTIFS
function.
Sum
To sum a range of cells, use the SUM function.
Sumif
To sum cells based on one criteria (for example, higher than 9), use the following SUMIF function (two
arguments).
To sum cells based on one criteria (for example, green), use the following SUMIF function (three arguments, last
argument is the range to sum).
Sumifs
To sum cells based on multiple criteria (for example, blue and green), use the following SUMIFS function (first
argument is the range to sum).
General note: in a similar way, you can use the AVERAGEIF and AVERAGEIFS function to average cells based
on one or multiple criteria.
Average
To calculate the average of a range of cells, use the AVERAGE function.
Averageif
To average cells based on one criteria, use the AVERAGEIF function. For example, to calculate the average
excluding zeros.
Note: <> means not equal to. The AVERAGEIF function is similar to the SUMIF function.
Calculating Date Difference using DATEDIF
To get the number of days, weeks or years between two dates in Excel, use the DATEDIF function. The DATEDIF
function has three arguments.
1. Fill in "d" for the third argument to get the number of days between two dates.
2. Fill in "m" for the third argument to get the number of months between two dates.
3. Fill in "y" for the third argument to get the number of years between two dates.
4. Fill in "yd" for the third argument to ignore years and get the number of days between two dates.
5. Fill in "md" for the third argument to ignore months and get the number of days between two dates.
6. Fill in "ym" for the third argument to ignore years and get the number of months between two dates.
Important note: the DATEDIF function returns the number of complete days, months or years. This may give
unexpected results when the day/month number of the second date is lower than the day/month number of the
first date. See the example below.
The difference is 6 years. Almost 7 years! Use the following formula to return 7 years.
Join Strings
To join strings, use the & operator.
Left
To extract the leftmost characters from a string, use the LEFT function.
Right
To extract the rightmost characters from a string, use the RIGHT function.
Mid
To extract a substring, starting in the middle of a string, use the MID function.
Len
To get the length of a string, use the LEN function.
Find
To find the position of a substring in a string, use the FIND function.
Substitute
To replace existing text with new text in a string, use the SUBSTITUTE function.
Analysing Database with PivotTable and PivotChart
Pivot Tables
Pivot tables are one of Excel's most powerful features. A pivot table allows you to extract the significance from a
large, detailed data set.
Our data set consists of 213 records and 6 fields. Order ID, Product, Category, Amount, Date and Country.
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.
Sort
To get Banana at the top of the list, sort the pivot table.
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?
3. Choose the type of calculation you want to use. For example, click Count.
4. Click OK.
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.
Group Pivot Table Items
This example teaches you how to group pivot table items. Learn how to group products and how to group dates by
months.
Below you can find a pivot table. Go back to Pivot Tables to learn how to create this pivot table.
Group Products
The Product field contains 7 items. Apple, Banana, Beans, Broccoli, Carrots, Mango and Orange.
Conclusion: Apple and Banana (Group1) have a higher total than all the other products (Group2) together.
Group Dates
To create the pivot table below, instead of the Product field, add the Date field to the Rows area. The Date field
contains many items. 1/6/2016, 1/7/2016, 1/8/2016, 1/10/2016, 1/11/2016, etc.
Note: also see the options to group by seconds, minutes, hours, etc.
Result:
Pivot table:
7. Click OK.
Result:
Multiple Report Filter Fields
First, insert a pivot table. Next, drag the following fields to the different areas.
1. Order ID to the Rows area.
The pivot table shows all the 'Broccoli' orders to the United Kingdom.
Slicers
You can insert slicers in Excel to quickly and easily filter pivot tables. However, using the report filter gives the exact same
result.
Below you can find a two-dimensional pivot table. Go back to Pivot Tables to learn how to create this pivot table.
Note: the report filter (cell B1) changes to Fruit. Hold down CTRL to include fruit and vegetables.
Refresh
If you change any of the text or numbers in your data set, you need to refresh the pivot table.
2. On the Analyze tab, in the Data group, click Change Data Source.
Tip: change your data set to a table before you insert a pivot table. This way your data source will be updated
automatically when you add or delete rows/columns. This can save time. You still have to refresh though.
Calculated Field/Item
This example teaches you how to insert a calculated field or calculated item in a pivot table.
Below you can find a pivot table. Go back to Pivot Tables to learn how to create this pivot table.
Calculated Field
A calculated field uses the values from another field. To insert a calculated field, execute the following steps.
2. On the Analyze tab, in the Calculations group, click Fields, Items & Sets.
6. Click Add.
Note: use the Insert Field button to quickly insert fields when you type a formula. To delete a calculated field,
select the field and click Delete (under Add).
7. Click OK.
Result:
Calculated Item
A calculated item uses the values from other items. To insert a calculated item, execute the following steps.
2. On the Analyze tab, in the Calculations group, click Fields, Items & Sets.
3. Click Calculated Item.
6. Click Add.
Note: use the Insert Item button to quickly insert items when you type a formula. To delete a calculated item,
select the item and click Delete (under Add).
7. Repeat steps 4 to 6 for North America (Canada and United States) and Europe (France, Germany and United
Kingdom) with a 4% and 5% tax rate respectively.
8. Click OK.
Result:
Note: we created two groups (Sales and Taxes).
Pivot Chart
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.
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.
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.
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 Switch Row/Column.