Instructions for 2014 SARA Conference Excel Session with Dianne Auld Naming Job Title, Grade and CTC ranges for use in Array formulas 1. Open the Array Formulas and Z-Scores Development workbook. 2. In the Emp Data & Calcs sheet, select the Job Title, Grade and CTC data from cells J1 to L6052. Do this by selecting cells J1 to L1, holding down the Shift Key, and pressing End then the down arrow. 3. Select the Formulas menu, and in the Defined Names section, click on the Create from Selection icon. Uncheck the box for Left Column and click OK. Excel will now name the data in each column selected based on the heading in the first row of that column, replacing spaces with underscores. 4. Click on the down arrow in the Name Box in the top left hand corner to see the three names created. If you click on any of these names, Excel will take you to the relevant named range. Calculating Medians, Quartiles and Percentiles per Grade using Array Formulas 1. In the Emp Data & Calcs sheet, click on cell S2 under the Median heading. 2. Enter the formula: =MEDIAN(IF(Grade=Q2,CTC)) and simultaneously press Control, Shift, Enter to enter the data as an array formula. You will see that the formula now has braces {} around it. 3. In cell R2, under the Lower Quartile heading, enter the formula: =QUARTILE(IF(Grade=$Q2,CTC),1) and press Control, Shift, Enter. 4. Copy this formula to cell T2 under the Upper Quartile heading, edit the 1 at the end of the formula to a 3 and press Control, Shift, Enter. The formula should look like this: {=QUARTILE(IF(Grade=$Q2,CTC),3)}. 5. In cell U2, under the 25th Percentile heading, enter the formula: =PERCENTILE(IF(Grade=$Q2,CTC),0.25) and press Control, Shift, Enter. 6. Copy this formula to cell V2 under the 50th Percentile heading, edit the 0.25 at the end of the formula to 0.5 and press Control, Shift, Enter. The formula should look like this: {=PERCENTILE(IF(Grade=$Q2,CTC),0.5)}. 7. Copy this formula to cell W2 under the 75th Percentile heading, edit the 0.25 at the end of the formula to 0.75 and press Control, Shift, Enter. The formula should look like this: {=PERCENTILE(IF(Grade=$Q2,CTC),0.75)}. 8. Select cells R2 to W2, and copy them down the table using the double click method. 1 Calculating Percentiles per Job using Remove Duplicates and Array Formulas 1. In the Emp Data & Calcs sheet select the whole of column J with the job titles. Copy Paste this column to column Y. 2. Select Data, Remove Duplicates, check the button for Continue with the current selection, click Remove Duplicates, OK, OK. This will leave you with one of each job title. 3. In cell Z2, under the 25th Percentile heading, enter the formula: =PERCENTILE(IF(Job_Title=$Y2,CTC),0.25) and press Control, Shift, Enter. 4. Copy this formula to cell AA2 under the 50th Percentile heading, edit the 0.25 at the end of the formula to 0.5 and press Control, Shift, Enter. The formula should look like this: {=PERCENTILE(IF(Job_Title=$Y2,CTC),0.5)). 5. Copy this formula to cell AB2 under the 75th Percentile heading, edit the 0.25 at the end of the formula to 0.75 and press Control, Shift, Enter. The formula should look like this: {=PERCENTILE(IF(Job_Title=$Y2,CTC),0.75)). 6. Select cells Z2 to AB2, and copy them down the table using the double click method. Creating a Pivot Table to Calculate Average and Standard Deviation CTC per Job 1. In the Emp Data & Calcs sheet select all of the employee data by clicking anywhere in the headings and pressing Control A to select the whole table. 2. Select the Insert Menu, Pivot Table, OK. 3. Drag Job Title into the Row Labels box. 4. Drag CTC twice into the Values box. 5. In the pivot table itself, double click on the heading Sum of CTC. 6. Select Average, then Number Format, Number. Change the decimal places to 0, and check the box for Use 1000 Separator. Click OK twice. 7. In the pivot table, double click on the heading Sum of CTC2. 8. In the Value Field Settings window, drag the scroll bar down and select StdDevp. Click on Number Format, Number. Change the decimal places to 0, and check the box for Use 1000 Separator. Click OK twice. 9. Click on the StdDev of CTC2 heading, and in the formula bar delete the 2 at the end of the heading. 10. You have now calculated the average and standard deviation cost to company for each job in the organisation. 2 Calculating Z-Scores per Job using VLOOKUP, Z-Score and IFERROR formulas 1. In the Emp Data & Calcs sheet, in cell M2, beneath the Average heading, enter the formula: =VLOOKUP($J2,'Pivot Table'!$A$4:$C$163,2,FALSE). Copy this formula down the table using the double click method. This will read in the average / mean CTC per job from the pivot table. 2. In the Emp Data & Calcs sheet, copy the VLOOKUP formula in cell M2 to cell N2, beneath the Standard Deviation heading. Edit the number of columns at the end of the formula from 2 to 3. The formula should now look like this: =VLOOKUP($J2,'Pivot Table'!$A$4:$C$163,3,FALSE). Copy this formula down the table using the double click method. This will read in the standard deviation (typical variance) of the CTC per job from the pivot table. 3. In the Emp Data & Calcs sheet, in cell O2, beneath the Z-score (CTC - Ave) / Std Dev heading, enter the formula: = (L2-M2)/N2. Copy this formula down the table using the double click method. This will calculate the Z-score (number of standard deviations from the mean) per employee. 4. However, note that if there is only one employee in a job, the standard deviation will be zero, and the Z-score therefore shows as #DIV/0!, because you cannot divide by zero. For this reason, edit the formula in cell O2 to =IFERROR((L2-M2)/N2,0). This will replace any #DIV/0! errors with a zero, which is correct. This employee is zero standard deviations from the mean. Copy this formula down the table using the double click method. Adding Conditional Formatting to the Z-scores to highlight those below -2 and greater than +2, and Filtering by Colour to find Anomalies 1. Z-scores of greater than 2 or less than -2 are regarded as outliers, with significant variance from the mean. These should be investigated as to the reasons for the variance. These may be acceptable, e.g. for high outliers - market premium required, scarce skills, exceptional performance, or for low outliers - employee on probation, employee in training, low paying geographical area, or may require corrective action if they cannot be adequately explained. 2. To easily find the outlying z-scores, apply conditional formatting to the z-scores. 3. Select all the z-scores from cell O2 to O6052. To do this, click on cell O2, hold down the shift key, press End and then the down arrow. 4. Select the Home menu, Conditional Formatting, Highlight Cells Rules, Greater Than. Under Format cells that are GREATER THAN:, edit the number in the box to 2. On the right, where it says Light Red Fill with Dark Red Text, click on the down arrow, choose Custom Format, and set the formatting to bold blue, click OK twice. 5. Still with the z-scores selected, again Select the Home menu, Conditional Formatting, Highlight Cells Rules, Less Than. Under Format cells that are LESS THAN:, edit the number in the box to -2. On the right, where it says Light Red Fill with Dark Red Text, click on the down arrow, choose Custom Format, and set the formatting to bold red, click OK twice. 6. Click anywhere in the header row and select the Data menu, then click on the Filter icon. 3 7. In the z-score heading cell, click on the down arrow, choose Filter by Color, and filter to either the red or blue colour, to find the anomalies. 8. Alternatively, to see all the anomalies together, choose Number Filters, Custom Filter, and use the Custom Autofilter box to filter to numbers that are greater than 2 or less than -2. Click OK. Dianne Auld Auld Compensation Consulting www.auldcc.com 4