27.12 HR: Headcount, Attrition and Salary
Example first. Shraddha Bagale 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.
HR project — 30 सेकंदात
काय: HR चा tracker: tblStaff नावाची एक Table, AnnualCTC हा calculated column, KPI cells, City प्रमाणे PivotTable, एक chart आणि एका पानाचा dashboard.
का: खऱ्या HR report चा हाच आकार असतो: Active Headcount, Attrition %, Average Salary (Active) हे आकडे manager सगळ्यात आधी वाचतो.
छोटं उदाहरण: 6 rows मधून Active Headcount = 4, Attrition % = 33.3%, Average Salary (Active) = ₹33,250.
HR project — 30 सेकंड में
क्या: HR का tracker: tblStaff नाम की एक Table, AnnualCTC calculated column, KPI cells, City के हिसाब से PivotTable, एक chart और एक पन्ने का dashboard.
क्यों: असली HR report का यही आकार होता है: Active Headcount, Attrition %, Average Salary (Active) वे आँकड़े हैं जो manager सबसे पहले पढ़ता है.
छोटा उदाहरण: 6 rows से Active Headcount = 4, Attrition % = 33.3%, Average Salary (Active) = ₹33,250.
First look at the data (before → after):
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 |
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 |
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 |
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:
- Type the data and press Ctrl+T; name the Table
tblStaffin Table Design › Properties › Table Name. - Add the column AnnualCTC with
=[@Salary]*12; the Table fills it down. - On a KPI sheet type
=COUNTIF(tblStaff[Status],"Active")and the other KPI formulas from the table below. - Click Insert › PivotTable › From Table/Range, put City in Rows and AnnualCTC in Values (Sum).
- Click PivotTable Analyze › PivotChart › Clustered Column, then PivotTable Analyze › Insert Slicer › Dept.
- Move the KPI cells, the chart and the slicer onto a sheet named Dashboard.
स्टेप बाय स्टेप करून बघा:
- Data type करा आणि Ctrl+T दाबा; Table Design › Properties › Table Name मध्ये Table ला
tblStaffनाव द्या. - AnnualCTC column
=[@Salary]*12ने जोडा; Table तो खाली भरते. - KPI sheet वर
=COUNTIF(tblStaff[Status],"Active")आणि खालच्या table मधले बाकीचे KPI formulas type करा. - Insert › PivotTable › From Table/Range वर click करा, Rows मध्ये City आणि Values मध्ये AnnualCTC (Sum) ठेवा.
- PivotTable Analyze › PivotChart › Clustered Column वर click करा, मग PivotTable Analyze › Insert Slicer › Dept.
- KPI cells, chart आणि slicer Dashboard नावाच्या sheet वर हलवा.
स्टेप बाय स्टेप करके देखें:
- Data type करें और Ctrl+T दबाएँ; Table Design › Properties › Table Name में Table को
tblStaffनाम दें. - AnnualCTC column
=[@Salary]*12से जोड़ें; Table उसे नीचे भर देती है. - KPI sheet पर
=COUNTIF(tblStaff[Status],"Active")और नीचे की table के बाकी KPI formulas type करें. - Insert › PivotTable › From Table/Range पर click करें, Rows में City और Values में AnnualCTC (Sum) रखें.
- PivotTable Analyze › PivotChart › Clustered Column पर click करें, फिर PivotTable Analyze › Insert Slicer › Dept.
- KPI cells, chart और slicer को Dashboard नाम की sheet पर ले जाएँ.
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.
Calculated column formulas:
| Column | Formula |
|---|---|
| AnnualCTC | =[@Salary]*12 |
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 |
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 |
Chart and dashboard (one under the other):
- Click inside the PivotTable, then PivotTable Analyze › PivotChart › Clustered Column › OK.
- Add a chart title and data labels with Chart Design › Add Chart Element.
- Click PivotTable Analyze › Insert Slicer, tick Dept and click OK.
- 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. - Cut and paste the chart and slicer onto the Dashboard sheet.
- 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):
- Which city has the highest sum of AnnualCTC?
- Filter the Table on City = Nashik (Data › Filter): what is Active Headcount for Nashik alone?
- 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.
Ravindra Bagale's Tip – मराठी
Active Headcount ची व्याख्या त्याच्या KPI card खाली छोट्या अक्षरात लिहा. एकच dashboard वाचणाऱ्या दोघांचं त्या आकड्याच्या अर्थावर एकमत हवं.
Ravindra Bagale's Tip – हिंदी
Active Headcount की परिभाषा उसके KPI card के नीचे छोटे अक्षरों में लिखें. एक ही dashboard पढ़ने वाले दो लोगों को उस आँकड़े के मतलब पर सहमत होना चाहिए.
Loading practice tasks...
- Total leave days (Easy): Add up Leave days in D2:D11.
- Average salary (Easy): Average of E2:E11, rounded to 2 decimals.
- Rows in Sales (Easy): How many rows have Department "Sales"?
- Largest leave days (Easy): The largest value in D2:D11.
- Leave days for Sales (Medium): Total of D2:D11 where B is "Sales".
- Sales in Seattle (Medium): Total of D2:D11 where B is "Sales" and C is "Seattle".
- Best in Sales (Medium): Largest E2:E11 value where B is "Sales".
- Value of row 2 (Medium): D2 times E2.
- Look up Sophie Martin (Medium): The Leave days for "Sophie Martin" (use a lookup on column A).
- Total value (Hard): Sum of D times E for all rows.
- Share of Sales (Hard): Share of D2:D11 that is "Sales", rounded to 3 decimals.
- Rank of row 2 (Hard): Rank of D2 among D2:D11 (largest = 1).
- Above average? (Hard): "Above" if E2 is above the average of E2:E11, else "Below".