Ravindra BagaleCourses & study guides मराठी Track your progress

27. 20 Industry Projects

Excel

27.12 HR: Headcount, Attrition and Salary

Example first. Tara Joshi handles HR reports for a fictional delivery company and wants headcount, attrition and pay on one page.

HR project — in 30 seconds

What: A HR tracker: one Table tblStaff, the calculated column AnnualCTC, KPI cells, a PivotTable by City, a chart and a one-page dashboard.

Why: This is the shape of a real HR report: Active Headcount, Attrition %, Average Salary (Active) are the numbers a manager reads first.

Tiny example: From 6 rows: Active Headcount = 4, Attrition % = 33.3%, Average Salary (Active) = ₹33,250.

First look at the data (before → after):

HR project: before and after tables, fictional FreshGo Maharashtra data

Expected result — Calculated column

EmpID AnnualCTC
E-301 ₹3,36,000
E-302 ₹3,84,000
E-303 ₹3,12,000
E-304 ₹4,92,000
E-305 ₹3,60,000
E-306 ₹4,56,000

About this data: Teaching sample for a fictional shop “HomeNest Supplies”. Figures and names (e.g. Vikram Rao) are made up for this lesson on hr headcount attrition and salary.

Expected result — KPI cells (expected results)

KPI Formula Result
Active Headcount =COUNTIF(tblStaff[Status],"Active") 4
Attrition % =COUNTIF(tblStaff[Status],"Left")/ROWS(tblStaff[Status]) 33.3%
Average Salary (Active) =AVERAGEIFS(tblStaff[Salary],tblStaff[Status],"Active") ₹33,250

About this data: Demo table only — not real customer or company data. Built to practise hr headcount attrition and salary.

Before table and formula as text

Before — Table tblStaff (fictional sample rows)

EmpID City Dept Salary Status
E-301 Pune Operations 28,000 Active
E-302 Pune Sales 32,000 Left
E-303 Nashik Operations 26,000 Active
E-304 Nagpur Finance 41,000 Active
E-305 Kolhapur Sales 30,000 Left
E-306 Nashik Finance 38,000 Active

About this data: Made-up rows so you can copy the pattern for hr headcount attrition and salary. Currencies may use ₹, £, € or $.

Formula / click path

AnnualCTC: =[@Salary]*12
Active Headcount: =COUNTIF(tblStaff[Status],"Active")
Attrition %: =COUNTIF(tblStaff[Status],"Left")/ROWS(tblStaff[Status])
Average Salary (Active): =AVERAGEIFS(tblStaff[Salary],tblStaff[Status],"Active")

Do it step by step:

  1. Type the data and press Ctrl+T; name the Table tblStaff in Table Design › Properties › Table Name.
  2. Add the column AnnualCTC with =[@Salary]*12; the Table fills it down.
  3. On a KPI sheet type =COUNTIF(tblStaff[Status],"Active") and the other KPI formulas from the table below.
  4. Click Insert › PivotTable › From Table/Range, put City in Rows and AnnualCTC in Values (Sum).
  5. Click PivotTable Analyze › PivotChart › Clustered Column, then PivotTable Analyze › Insert Slicer › Dept.
  6. Move the KPI cells, the chart and the slicer onto a sheet named Dashboard.

The brief. Build an HR sheet: annual CTC per employee, active headcount, attrition % for this simple practice (people who left ÷ all people in the list), average salary of active staff, CTC by city, a chart and a Dept slicer. This attrition % is a simple share of the list, not a formal attrition rate: a formal rate counts the people who left during a set period and divides by the average headcount for that same period, so the two numbers can differ.

Calculated column formulas:

Column Formula
AnnualCTC =[@Salary]*12

About this data: Fictional worksheet used in class. Safe to edit; nothing here is live production data.

KPI cells (check your numbers):

KPI Formula Result
Active Headcount =COUNTIF(tblStaff[Status],"Active") 4
Attrition % =COUNTIF(tblStaff[Status],"Left")/ROWS(tblStaff[Status]) 33.3%
Average Salary (Active) =AVERAGEIFS(tblStaff[Salary],tblStaff[Status],"Active") ₹33,250

About this data: Teaching sample for a fictional shop “HomeNest Supplies”. Figures and names (e.g. Vikram Rao) are made up for this lesson on hr headcount attrition and salary.

PivotTable (expected):

City Sum of AnnualCTC
Kolhapur ₹3,60,000
Nagpur ₹4,92,000
Nashik ₹7,68,000
Pune ₹7,20,000
Grand Total ₹23,40,000

About this data: Demo table only — not real customer or company data. Built to practise hr headcount attrition and salary.

Chart and dashboard (one under the other):

  1. Click inside the PivotTable, then PivotTable Analyze › PivotChart › Clustered Column › OK.
  2. Add a chart title and data labels with Chart Design › Add Chart Element.
  3. Click PivotTable Analyze › Insert Slicer, tick Dept and click OK.
  4. Insert a new sheet named Dashboard. In it, link a card cell to each KPI (for example =KPI!B2) and format it large and bold.
  5. Cut and paste the chart and slicer onto the Dashboard sheet.
  6. On the View tab, untick Gridlines in the Show group. Select the dashboard area and click Page Layout › Print Area › Set Print Area.

Template and guide: download the practice template HR_Template.xlsx and read the step-by-step template guide. The template's sample rows may differ from the rows above; the method is the same.

Practice task (try it before you open the answer):

  1. Which city has the highest sum of AnnualCTC?
  2. Filter the Table on City = Nashik (Data › Filter): what is Active Headcount for Nashik alone?
  3. Add the Clustered Column PivotChart and the Dept slicer to your Dashboard sheet.
Answer

Nashik (₹7,68,000). For Nashik only (2 rows): Active Headcount = 2. The chart shows 4 bars, one per city.

Ravindra Bagale's Tip

Write the definition of Active Headcount under its KPI card in small text. Two people reading the same dashboard should agree on what the number means.

Loading practice tasks...

  1. Total headcount (Easy): Add up Headcount in C2:C11. (sheet "Data")
  2. Average salary (Easy): Average of Avg salary (₹) in F2:F11, rounded to 0 decimals. (sheet "Data")
  3. Pune rows (Easy): How many rows have City "Pune"? (sheet "Data")
  4. Max leavers (Easy): Largest Leavers in E2:E11. (sheet "Data")
  5. Total joiners (Easy): Add up Joiners in D2:D11. (sheet "Data")
  6. Sales headcount (Medium): Total of Headcount where Department is "Sales". (sheet "Data")
  7. IT leavers (Medium): Total of Leavers where Department is "IT". (sheet "Data")
  8. Pune joiners (Medium): Total of Joiners where City is "Pune". (sheet "Data")
  9. Ops Mumbai headcount (Medium): Headcount where Department is "Ops" and City is "Mumbai". (sheet "Data")
  10. Net change row 2 (Hard): D2 minus E2. (sheet "Data")
  11. Attrition rate proxy (Hard): Total leavers / total headcount, 3 decimals. (sheet "Data")
  12. High salary rows (Hard): How many rows have Avg salary (₹) > 50000? (sheet "Data")
  13. Above avg headcount? (Hard): "Large" if C2 > average headcount else "Small". (sheet "Data")