Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
November 2010 LB
Table of Contents
Chapter I: Advanced Statistical Functions ...................................................................................... 3 COUNT, COUNTA and COUNTIF Functions .......................................................................................... 3 SUMIF Function ................................................................................................................................... 4 Nested IF Functions ............................................................................................................................. 4 Other Nested Functions in a IF FunctIon ............................................................................................. 5 Chapter II: Goal Seek .................................................................................................................... 7 Chapter III: Lookup and Index Functions........................................................................................ 9 Lookup Function .................................................................................................................................. 9 INDEX Function .................................................................................................................................. 10 Chapter IV: Databases ................................................................................................................ 13 Database Elements ............................................................................................................................ 13 View and Hide Columns .................................................................................................................... 13 Sort Data............................................................................................................................................ 13 Subtotals............................................................................................................................................ 14 AutoFilters ......................................................................................................................................... 15 Advanced Filters ................................................................................................................................ 17 Chapter V: Pivot Tables .............................................................................................................. 18 Create a Pivot Table .......................................................................................................................... 18 Fill your Pivot Table ........................................................................................................................... 19 Change theType of Calculation ......................................................................................................... 19 Change the Layout............................................................................................................................. 19 Update your Pivot Table .................................................................................................................... 19 Excel 2010 Pivot Table Improvements .............................................................................................. 20 Chapter VI: Grouping Sheets ....................................................................................................... 22 Chapter VII: Consolidation .......................................................................................................... 23 Consolidate by Position ..................................................................................................................... 23 Consolidate by Category ................................................................................................................... 23 Chapter VIII: Protection .............................................................................................................. 25 Keyboard Shortcuts .................................................................................................................... 27
Soprotec Formations SA
2/27
After a survey, you would like to know how many families were questioned, how many answered, and how many have more than 2 children.
1 2 3 4 5 6 7 8 9 10 11 12 A FAMILIES Papin Fallepa Van der Berg Deschamps Vanek Salomon Mantilla Tangui Coulour Manson Guilleri B NUMBER OF CHILDREN 4 No answer 1 3 2 0 3 1 No answer 2 4 C Number of families 11 Number of answers 9 Number of families with more than 2 children 4
Soprotec Formations SA
3/27
SUMIF FUNCTION
The SUMIF function adds the cells specified by a given condition. The syntaxis: =SUMIF(range;criteria;sum_range) The range is the block of cells you want to evaluate, to see if they meet the criteria. The sum_range is the block of cells containing the numbers to add, if the corresponding value meets the criteria. LETS PRACTICE Objective: Using function SUMIF In this example, there are 2 teams in a competition. In each team, the members received some points. You need to add the number of points of each team. The criteria is the team number (1 or 2).
A 1 2 3 4 5 6 7 8 9 10 Alain Maurice Jos Mara Andrea Laurent Sum Sum B Team 1 2 1 2 2 1 1 2 C Number of points 25 25 18 24 21 22 65 70
1 2 3 4
Click in C9 Type : =SUMIF(B2:B7;B9;C2:C7) Do the same for C10. You can copy the formula with the fill handles. In this case, you need to type: =SUMIF($B$2:$B$7;B9;$C$2:$C$7)
NESTED IF FUNCTIONS
The IF function evaluates a condition (a logical test). If the condition is met (true), the value called value if true is shown. If the condition is not met (false), the value called value if false is shown. The syntax of the IF function is: =IF(logical test;value if true;value if false) It is possible to nest multiple IF functions within one formula. The value if false argument can be replaced by another IF function. The syntax will be: =IF(logical test;value if true; IF(logical test;value if true;value if false))
Soprotec Formations SA
4/27
LETS PRACTICE Objective: Using nested IF functions and the SUMIF function You need to group people by category depending on their revenue.
Conditions Annual revenue Smaller or equal to Smaller or equal to More than A 1 2 3 4 5 6 7 8 9 10 11 12 Paul Peter Jean Susy Arancha Paulina Jos Sum Sum Sum $ $ $ $ $ $ $ Limit $ 30000 $ 55000 $ 55000 B Annual revenue 45000 55000 28000 121000 98000 18650 51500 Category Small revenue Medium revenue Large revenue C Category medium revenue medium revenue small revenue large revenue large revenue small revenue medium revenue $ $ $ 46'650 151500 219000
1 2 3 4
Click inC2and type the beginning of the formulas: =IF(B2<=30000;"small revenue"; You need a second IF function. The logical test is: IF(B2<=55000; Then type the value if true and value if false of this second IF function. When the formula is completed, press ENTER and copy the formula below with the fill handle. The complete formula should be: =IF(B2<=30000;"small revenue";IF(B2<=55000;"medium revenue";"large revenue")) 5 Fins the SUMIF formula in cell C10, validate the formula by pressing ENTER and copy the formula below with the fill handle.
Soprotec Formations SA
5/27
In a given group, we are searching for people who are blond AND have blue eyes. Then we are searching for people who are blond OR have blue eyes.
A 1 2 3 4 5 6 Name Jean Danile Marie Edouard Paul B Hair color Blond Brun Brun Roux Blond C Eyes color Vert Brun Bleu Brun Bleu D Decision (AND) non non non non oui E Decision (OR) oui non oui non oui
6 Click in D2 and type the beginning of the formula: =IF( 7 You need to evaluate 2 criteria: =IF(AND 8 Type the criteria :
=IF(AND(B2="Blond";C2="Bleu") 9 Then type the value if true and value if false: =IF(AND(B2="Blond";C2="Bleu");"oui";"non") 10 When the formula is completed, press ENTER and copy the formula below. 11 In E2, type the same formula with OR instead of AND. LETS PRACTICE Objective: Using nested AND and OR functions with an IF function In this exercise, you need to know if a candidate meets the criteria for the job. First, the candidate must meet all the conditions: speak at least 2 languages AND have good computer knowledge. Then, the candidate must meet at least one condition: speak at least 2 languages OR have a good computer knowledge Show OUI for candidates corresponding to the criteria and NON for the others.
A 1 2 3 4 5 6 7 8 9 10 11 Alain Maurice Jos Mara Andrea Laurent Chantal Basile Nicolas Vronique B Nb de langues parle 2 3 2 1 1 2 4 3 2 1 C Comptences en informatique Bonne Aucune Bonne Aucune Bonne Aucune Bonne Bonne Aucune Bonne D Dcision (ET) Oui Non Oui Non Non Non Oui Oui Non Non E Dcision (OU) Oui Oui Oui Non Oui Oui Oui Oui Oui Oui
Soprotec Formations SA
6/27
1 Prepare your table. 2 Cell B4 contains this formula: =B2*B3 3 Cell B3 contains the salary per hour, 0 SFr for 4 5 6 7 8 9
now. The Goal Seek tool will modify this value to find the solution. Under the Data tab, in the Data Tools group, click What-If Analysis -> Goal Seek. A dialog box appears. In the Set Cell zone, indicate the cell containing your goal (B4). In the To Value zone, type the value you want to meet in the Goal cell: 5500. In the By changing cell zone, indicate the cell to be modified: B3. Click OK. Excel shows a dialog box. If the Current value is equal to the Target value, the result is found. To earn 5'500 SFr. You need to ask 37.41 SFr. per hour.
1 2 3 4
A Hours per week Hours per month Salary per hour Salary per month
B 35 147 0 0
LETS PRACTICE Objectives: Using Goal Seek Using a new function. The function FV( ) is useful to calculate an investment. The syntax is: =FV(rate;nper;pmt)
Function FV rate nper pmt Signification Future value of an investment. Interest rate on the period Total number of periods, i.e. months, trimesters or years Payment made each period.
Soprotec Formations SA
7/27
You want to save 200'000 SFr. To pay the studies of your children in 18 years. The annual interest rate is 5%. How much do you need to pay per year?
3 4 5 6
1 Financement future amount. At the end of the payments, this cell 2 should contain 200'000 SFr. 3 Interest rate =FV(B3;B4;B5) 5% 4 Periods 18 The cell B5 contains the annual payment, i.e. 0 SFr. 5 Annuity (payment) 0 The Goal Seek will modify this value. 6 Cells B3 and B4 contain constants. 7 Final amount 0 Launch the Goal Seek tool. If the target value is equal to the current value, the result is correct. You must put each month 7'109.24 in your bank account to have 200'000 in 18 years.
Cash you pay out, such as deposits to savings, is represented by negative numbers.
Soprotec Formations SA
8/27
LOOKUP FUNCTION
The LOOKUP function provides the possibility to find values in a list or a table. The column or the row where Excel makes the search must be sorted in an ascending order. The LOOKUP function always has 3 arguments: WHAT : we are looking for the value in a specific cell. WHERE : we are looking for the value of that cell in a specific range. RESULT : find the value to return in a specific range. LETS PRACTICE Objective: Using the LOOKUP function alone and nested in a IF function. In this exercise, you must find the name and the category of the participants by using their number.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 A Number 125 126 127 128 129 130 131 132 133 Time 25.54 min 23.25 min 41.20 min 19.23 min 16.24 min 18.26 min B Participant Godreche Van Khun Bilbo Petrovich Marcovitch Reuter Jenking Poussin Welter Number 130 133 128 125 131 127 C Category Junior Cadet A Cadet B Cadet A Cadet B Junior Junior Cadet A Junior Participant Reuter Welter Petrovich Godreche Jenking Bilbo D
1 Click inC13. Use function LOOKUP to find the participants name corresponding to the
number (column B) WHAT : we are looking for the value ofB13 WHERE : in rangeA2:A10 RESULT : to be found in rangeB2:B10 (name). 2 Type the formula and press ENTER
Soprotec Formations SA
9/27
If B13 is empty, Excel writes an error message. To solve this issue, you can nest the LOOKUP function in a IF function. IF B13 is empty, nothing should appear, but if its not the case the LOOKUP function should be executed.
INDEX FUNCTION
The INDEX function returns the value of the cell at the intersection of a particular row and column, in a given range. The syntaxis: =INDEX(range;row_num)
Fonction range row_num Signification Range of one or several cells. Selects the number of the row from which to return the value (1 is the first row of the range).
Soprotec Formations SA
10/27
LETS PRACTICE Objective: Using INDEX( ) Using PMT( ) to calculate the payment for a loan based on constant payments. The syntax is: =PMT(rate;nper;pv)
Fonction PMT rate nper pv Signification The payment for a loan The interest rate for the loan. The total number of payments for the loan. The present value.
2 In cell B3 type the formula to calculate the amount of the loan: =B1*(1-B2) 3 In cell B6 type the PMT formula to find the payment amount per month
=PMT(B4/12;B5*12;B3) Cell B4 contains the annual rate. Divide by 12 for the monthly rate. Cell B5 contains the annual duration. Divide by 12 for monthly payments. 4 Prepare the following table:
1 2 3 4 5 6 7 Alfa 156 Peugeot 306 Opel Vectra Citron ZX Rover 600 E Car BMW srie 3 SFr. SFr. SFr. SFr. SFr. SFr. F Price 40'000 25'000 18'000 24'000 22'000 38'000
5 Under the Developer tab, in the Controls group, click Insert -> Combo Box . 6 Draw a combo box button.
Soprotec Formations SA
11/27
7 Right click on the button -> Format Control. 8 In the Input Range box, select E2 to E7. In the
Cell link box, select E9. Click OK.
Soprotec Formations SA
12/27
DATABASE ELEMENTS
A database requires column headers in the first row. We call these headers field names, because each column is a field. Each row in the database is called a record. For example, each address of a list of addresses is a record.
1 2 3 4
Select the column you want to hide by clicking on the columns letter. Right click on your selection -> Hide. The selected column is hidden. To view the column again, select the column to the right and the column to the left of the hidden column. 5 Right click on your selection->Unhide. Rows can be hidden in the same way.
SORT DATA
The buttons Sort A to Z (1 to 999, A to Z) and Sort Z to A (999 to 1, Z to A) are useful to sort by one column.
1 Click on a cell of the column to be sorted. 2 Under the Home tab, in the Edition group, click Sort and filter-> Sort A to Z. 3 Excel selects automatically the whole table. The column titles are not included for sorting.
If your table contains birth dates, you can also sort it in an ascending order.
Do not select a range to sort. Select only one cell when sorting. Excel selects automatically the whole table. If you select a range of cells, Excel will sort only the range, moving cells in that column away from other cells in the same row.
You can sort your data based on several criteria at once. The first criterion has priority. To do this you need to make a custom sort:
1 Click on a cell of your table. Under the Home tab, in the Edition group, click on Sort and Filter >Custom sort.
Soprotec Formations SA
13/27
2 3 4 5 6
Select the column you want in the Sort by zone. Change if necessary the order. Click Add Level to add a second criterion. Select the column you want in the Sort by zone. Make sure that My data has headers is checked. Validate with OK
SUBTOTALS
You can use Excel Subtotals feature to subtotal data in a sorted list. To subtotal a list, you first sort the list on the field for which you want the subtotals, and then you designate the field that contains the values you want summed these dont have to be the same fields in the list.
1 2 3 4
Sort the list on the field for which you want subtotals inserted. Click the Subtotal button in the Outline group on the Data tab. The Subtotal dialog box appears. Select the field for which the subtotals are to be calculated in the At Each Change In drop-down list. 5 Specify the type of totals you want to insert in the Use Function drop-down list. 6 Select the check boxes for the field(s) you want to total in the Add Subtotal To list box. 7 Click OK. Excel adds the subtotals to the worksheet.
Soprotec Formations SA
14/27
Notice the and signs to the left of your data where you can expand and collapse your subtotals to reveal just the subtotals for all or any one category. Try expanding and collapsing the different rows to see all the different types of reports you could now print for this data.
AUTOFILTERS
In a list, it is often useful to show only the rows corresponding to one or several criteria. For example, only the customers of a specific city, or those who have not ordered anything since last year, etc. A filter can do this. The autofilter lets you define quickly simple criteria.
1 2 3 4 5
Click on a cell of your table, Under Home, in the Edition group, click Sort and Filter -> Filter. A dropdown arrow appears besides each column heading. Choose a criterion from one of the dropdown lists. Confirm with OK. Rows that don't meet the criteria will be hidden. To further filter the list, choose from another column's dropdown list.
To show everything again, under Home, in the Edition group, click Sort and Filter ->Clear. To remove autofilter dropdown arrows, click again on Sort and Filter-> Filter. CUSTOM AUTOFILTERS To select your records more precisely, you can use the custom autofilter.
1 Activate the autofilter. 2 Click on the dropdown arrow of the column you
want ->Number filters (or text filters) ->Custom filter. 3 Select your criteria and confirm with OK.
When filtering data, you can take advantage of a new search box, which helps you to quickly find what you need in large worksheets.
Soprotec Formations SA
15/27
LETS PRACTICE Objective: Use database tools 1 Rename a new sheet Sales per Country. Create the following table. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 A Country Switzerland Germany France Italy Switzerland Germany France Italy Switzerland Germany France Italy Switzerland Germany France Italy B Month January February March January February March January February March January February March January February March January C Seller Dubol Dubol Truand Truand Sakapus Sakapus Lecru Lecru Dubol Dubol Truand Truand Sakapus Sakapus Lecru Lecru Sales SFr. SFr. SFr. SFr. SFr. SFr. SFr. SFr. SFr. SFr. SFr. SFr. SFr. SFr. SFr. SFr. D 193 256 12 78 186 269 114 56 210 350 11 89 212 297 103 74
Soprotec Formations SA
16/27
ADVANCED FILTERS
You can specify complex filtering criteria and designate a specific area of your worksheet to manage your criteria selections when filtering table data. CREATE THE CRITERIA RANGE The criteria range should be headed by headers that match the headings of your table. The criteria for should be listed under each of these headings.
1 Copy-paste the headings you need. 2 Enter the criteria under the corresponding headings.
Note: When criteria are written on the same row, they are linked with the AND operator. When they are written on several rows, they are linked with an OR operator. APPLY THE FILTER 3 When your criteria range is ready, you can apply the filter. 4 Click on a cell of your list. 5 Under the Data tab, in the Sort & Filter group, click Advanced. The dialog boy appears. 6 In the Criteria Range zone, select your criteria range (with the headings). 7 Validate with OK.
Soprotec Formations SA
17/27
The pivot table is divided into 4 zones. Each one has a specific role.
Zone
Description
To show totals. To show fields in rows To show fields in columns To filter the whole table
Soprotec Formations SA
18/27
1 Right click on a cell in your table and choose Pivot Table Options. 2 A dialog box appears. 3 Choose the layout options and validate with OK.
Soprotec Formations SA
19/27
Soprotec Formations SA
20/27
Lets practice Objective: Elaborating a pivot table Open the table Sales per country (see Databases). 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 A Country Switzerland Germany France Italy Switzerland Germany France Italy Switzerland Germany France Italy Switzerland Germany France Italy B Month January February March January February March January February March January February March January February March January C Seller Dubol Dubol Truand Truand Sakapus Sakapus Lecru Lecru Dubol Dubol Truand Truand Sakapus Sakapus Lecru Lecru Sales SFr. SFr. SFr. SFr. SFr. SFr. SFr. SFr. SFr. SFr. SFr. SFr. SFr. SFr. SFr. SFr. D 193 256 12 78 186 269 114 56 210 350 11 89 212 297 103 74
You need to summarize and analyze the results by country, by month and by seller.
1 2 3 4 5 6 7
Click on a cell of your table. Under the Insert tab, in the Tables group, click PivotTable -> PivotTable. A dialog box appears. Click OK. In the field list, drag the field Seller below, to the Row Label zone. Move the field Month to the Column Label zone. Move the field Country to the Report Filter zone. Under the Design tab, click Report Layout -> Show in Outline Form.
Your pivot table is done! You can adapt the presentation to your needs by moving fields, by using autofilters, or by changing the options. Try for example to:
8 Switch Month and Seller. 9 Show only French and Swiss results. 10 Edit your data source and update your pivot table.
Soprotec Formations SA
21/27
1 Select the first sheet of the group. 2 Hold down the Ctrl key, and click on the on the tabs of the other sheets to include in the group.
In the title bar, the word [Group] appears. 3 Type your data. You are typing on all the sheets simultaneously. 4 To deactivate your group, click on any sheet outside of the group. Lets practice Objective: Creating and using a group of sheets You need to type the results of Q1 and Q2.
1 2 3 4 5
Rename 3 sheets: Q1, Q1 and Total. Click on the first Q1. Hold down Ctrl and select the two other sheets. Enter your table on all the sheets at the same time. Deactivate the group. Complete now sheet Q1 and Q2 separately. Q1 Sales Cosmetics Clothes Sport Total 850 196 70 1116 Sales Cosmetics Clothes Sport Total 1050 300 250 1600 Q2 Sales Cosmetics Clothes Sport Total Total
Soprotec Formations SA
22/27
CONSOLIDATE BY POSITION
1 2 3 4 5
Click the upper-left cell of the area where you want the consolidated data to appear. Under the Data tab, in the Data Tools group, click Consolidate. A dialog box appears. In the Reference box, indicate the first range (select only the numbers). Click Add. Repeat this last step for every range you want to consolidate. Click OK.
CONSOLIDATE BY CATEGORY
1 2 3 4 5
Click the upper-left cell of the area where you want the consolidated data to appear. Under the Data tab, in the Data Tools group, click Consolidate. A dialog box appears. In the Reference box, indicate the first range (labels and numbers). Click Add. Repeat this last step for every range you want to consolidate. Select the check boxes under Use labels in that indicate where the labels are located in the source ranges: either the Top row, the Left column, or both. 6 Click OK. Lets Practice 1 Objective 1: Consolidate by position Lets take the example seen in the Grouping sheets chapter. Lets consolidate the tables Q1 and Q2 into the sheet Total.
1 In the sheet Total, select the first empty cell (next to Cosmetics). 2 Under the Data tab, in the Data Tools group, click Consolidate. 3 Click in the Reference box. Click sheet Q1 and select the 3 cells containing numbers. Then
click Add. 4 Do the same for sheet Q2. 5 Click OK.
Soprotec Formations SA
23/27
Lets Practice 2 Objective: Consolidate by category We are going to consolidate 2 tables representing the number of customers in a hotel in summer and winter.
3 4 5 6 7 8
Insert a new sheet. Rename it Total. Select cell A1. Under the Data tab, in the Data Tools group, click Consolidate. Click in the Reference box. Click sheet Summer and select the whole table. Then click Add. Do the same for Winter. Select Top Row and Left Column. Click OK. Your consolidated table is ready!
Soprotec Formations SA
24/27
Lets practice Objective: Protect a worksheet You created a pay sheet for all your staff. Some data are the same for everybody and can be protected to be sure they dont change (rates, etc.) Other data are different from one employee to another (number of hours, salary per hour).
1 Select the cells you want to unlock B1, C4 and E4. 2 Under the Home tab, in the Cells group, click Format -> Cell Format. 3 Click the Protection tab. To unlock the cells, clear the Locked check box, and then click OK.
To activate the protection, do the following:
4 Under the Review tab, in the Changes group, click Protect Sheet. 5 For more security, you can add a password. 6 When you type a password, you need to type it a second time.
Soprotec Formations SA
25/27
Password Use strong passwords that combine uppercase and lowercase letters, numbers, and symbols. Weak passwords don't mix these elements. It is critical that you remember your password. If you forget your password, Microsoft cannot retrieve it.
7 To move from one unlocked cell to another one, use the Tab key.
To remove the protection, under the Review tab, in the Changes group, click Unprotect Sheet.
Soprotec Formations SA
26/27
KEYBOARD SHORTCUTS
With the keyboard shortcuts you can save time by executing commands directly, without the mouse. Here are some useful shortcuts: GENERAL
Undo Cut Copy Paste Save Print Open Close CTRL + Z CTRL + X CTRL + C CTRL + V CTRL + S CTRL + P CTRL + O CTRL + W
FORMATTING
Cell Format Bold Italic Underline Standard Format Line Break CTRL + 1 CTRL + G CTRL + I CTRL + U CTRL + R ALT + ENTER
OTHER
Insert a row Insert a sheet Insert a function CTRL + + MAJ + F11 MAJ + F3
Complete List To see the complete list of shortcuts, press F1, and type shortcuts in the text zone.
Soprotec Formations SA
27/27