1. Lighthouse

Level 2 · Check and summarise headcount and pay in Excel

The request

From Laura Bennett, Head of Finance

“HR sent me the employee list without names: id, department, title, manager id, hire date and salary, 60 rows. Can you check the reporting lines hold together, then give me headcount and payroll by department and tell me how many people each manager has?”

Your goal

Step 1 of 3. Check the reporting lines. In G2:G61, return "no manager" if manager_id (D) is empty; otherwise look the manager_id up in the id column (A2:A61) with XLOOKUP and return that person's title (C), or "missing" if no id matches (one formula, filled down). Then J2 counts "no manager", J3 counts "missing", and J4 and J5 return the lowest and highest salary.

  • Fill G2:G61, J2:J5 with the right valuesnot done yet
  • With formulas, not typed numbersnot done yet
  • Use IF XLOOKUP COUNTIFnot done yet

Step 1 · your sheet

Excel
The sheet for this level
ABCDEFGHIJKLM
1employee_iddepartmenttitlemanager_idhire_datesalarymanager_titledirect_reports
21ExecutiveChief Executive Officer2016-03-01285,000No manager
32ExecutiveChief Operating Officer12017-01-09235,000Manager not found
43SalesHead of Sales12018-04-16172,000Lowest salary
54SalesAccount Executive32020-01-2172,000Highest salary
65SalesAccount Executive32023-05-2173,000
76SalesAccount Executive32021-02-0476,000departmentheadcountpayrollaverage
87SalesAccount Executive32021-06-1268,000Engineering
98SalesAccount Executive32020-01-3183,000Data & Analytics
109SalesSales Manager32018-07-01106,000Sales
1110SalesSales Associate92023-08-0755,000Marketing
1211SalesSales Associate92018-10-0251,000Operations
1312MarketingHead of Marketing12019-02-04165,000Customer Support
1413MarketingMarketing Manager122020-01-08107,000Executive
1514MarketingGrowth Marketer122019-04-2587,000Finance
1615MarketingGrowth Marketer122022-08-1088,000Merchandising
1716MarketingGrowth Marketer122020-04-0382,000Total
1817MarketingContent Strategist122019-04-1764,000
1918MarketingEmail Marketing Specialist122019-12-2771,000Managers
2019Data & AnalyticsHead of Data12020-08-03178,000Widest span
2120Data & AnalyticsSenior Data Analyst192022-03-24117,000Mean salary
2221Data & AnalyticsData Analyst192025-10-3191,000Median salary
2322Data & AnalyticsData Analyst192023-02-2082,000
2423Data & AnalyticsData Analyst192021-02-2880,000
2524Data & AnalyticsData Analyst192025-03-1592,000
2625Data & AnalyticsAnalytics Engineer192025-07-03116,000
2726OperationsHead of Operations22018-09-10158,000
2827OperationsWarehouse Manager262024-12-2884,000
2928OperationsLogistics Coordinator262022-05-2859,000
3029OperationsLogistics Coordinator262021-05-0355,000
3130OperationsLogistics Coordinator262021-03-2256,000
3231OperationsLogistics Coordinator262024-07-2262,000
3332OperationsInventory Specialist262020-12-1259,000
3433OperationsInventory Specialist262020-10-2154,000
3534Customer SupportHead of Customer Support22019-06-17128,000
3635Customer SupportSupport Team Lead342021-01-0372,000
3736Customer SupportSupport Specialist352025-10-3150,000
3837Customer SupportSupport Specialist352023-02-0243,000
3938Customer SupportSupport Specialist352024-09-1349,000
4039Customer SupportSupport Specialist342024-11-2044,000
4140Customer SupportSupport Specialist342020-04-0451,000
4241Customer SupportSupport Specialist342024-06-1947,000
4342Customer SupportSupport Specialist342023-05-1650,000
4443MerchandisingHead of Merchandising22018-01-22155,000
4544MerchandisingBuyer432019-11-0975,000
4645MerchandisingBuyer432023-09-1475,000
4746MerchandisingBuyer432020-01-2179,000
4847MerchandisingMerchandise Planner432021-06-2571,000
4948FinanceHead of Finance12017-11-06175,000
5049FinanceFinancial Analyst482019-05-1381,000
5150FinanceFinancial Analyst482024-05-0376,000
5251FinanceAccountant482021-01-1581,000
5352FinanceAccountant482021-09-3076,000
5453EngineeringHead of Engineering12019-03-25205,000
5554EngineeringSenior Software Engineer532024-04-02180,000
5655EngineeringSenior Software Engineer532024-03-10163,000
5756EngineeringSoftware Engineer532021-04-27142,000
5857EngineeringSoftware Engineer532023-08-21130,000
5958EngineeringSoftware Engineer532024-06-14116,000
6059EngineeringSoftware Engineer532023-04-29137,000
6160EngineeringSoftware Engineer532024-11-29125,000
62
63

Loading the editor…

    ResultPress Check to compare G2:G61, J2:J5

    Mote checks your result

    Press Check. Each right cell becomes a firefly in your lantern.

    Step 2 · your sheet

    Excel
    The sheet for this level
    ABCDEFGHIJKLM
    1employee_iddepartmenttitlemanager_idhire_datesalarymanager_titledirect_reports
    21ExecutiveChief Executive Officer2016-03-01285,000no managerNo manager1
    32ExecutiveChief Operating Officer12017-01-09235,000Chief Executive OfficerManager not found0
    43SalesHead of Sales12018-04-16172,000Chief Executive OfficerLowest salary43,000
    54SalesAccount Executive32020-01-2172,000Head of SalesHighest salary285,000
    65SalesAccount Executive32023-05-2173,000Head of Sales
    76SalesAccount Executive32021-02-0476,000Head of Salesdepartmentheadcountpayrollaverage
    87SalesAccount Executive32021-06-1268,000Head of SalesEngineering
    98SalesAccount Executive32020-01-3183,000Head of SalesData & Analytics
    109SalesSales Manager32018-07-01106,000Head of SalesSales
    1110SalesSales Associate92023-08-0755,000Sales ManagerMarketing
    1211SalesSales Associate92018-10-0251,000Sales ManagerOperations
    1312MarketingHead of Marketing12019-02-04165,000Chief Executive OfficerCustomer Support
    1413MarketingMarketing Manager122020-01-08107,000Head of MarketingExecutive
    1514MarketingGrowth Marketer122019-04-2587,000Head of MarketingFinance
    1615MarketingGrowth Marketer122022-08-1088,000Head of MarketingMerchandising
    1716MarketingGrowth Marketer122020-04-0382,000Head of MarketingTotal
    1817MarketingContent Strategist122019-04-1764,000Head of Marketing
    1918MarketingEmail Marketing Specialist122019-12-2771,000Head of MarketingManagers
    2019Data & AnalyticsHead of Data12020-08-03178,000Chief Executive OfficerWidest span
    2120Data & AnalyticsSenior Data Analyst192022-03-24117,000Head of DataMean salary
    2221Data & AnalyticsData Analyst192025-10-3191,000Head of DataMedian salary
    2322Data & AnalyticsData Analyst192023-02-2082,000Head of Data
    2423Data & AnalyticsData Analyst192021-02-2880,000Head of Data
    2524Data & AnalyticsData Analyst192025-03-1592,000Head of Data
    2625Data & AnalyticsAnalytics Engineer192025-07-03116,000Head of Data
    2726OperationsHead of Operations22018-09-10158,000Chief Operating Officer
    2827OperationsWarehouse Manager262024-12-2884,000Head of Operations
    2928OperationsLogistics Coordinator262022-05-2859,000Head of Operations
    3029OperationsLogistics Coordinator262021-05-0355,000Head of Operations
    3130OperationsLogistics Coordinator262021-03-2256,000Head of Operations
    3231OperationsLogistics Coordinator262024-07-2262,000Head of Operations
    3332OperationsInventory Specialist262020-12-1259,000Head of Operations
    3433OperationsInventory Specialist262020-10-2154,000Head of Operations
    3534Customer SupportHead of Customer Support22019-06-17128,000Chief Operating Officer
    3635Customer SupportSupport Team Lead342021-01-0372,000Head of Customer Support
    3736Customer SupportSupport Specialist352025-10-3150,000Support Team Lead
    3837Customer SupportSupport Specialist352023-02-0243,000Support Team Lead
    3938Customer SupportSupport Specialist352024-09-1349,000Support Team Lead
    4039Customer SupportSupport Specialist342024-11-2044,000Head of Customer Support
    4140Customer SupportSupport Specialist342020-04-0451,000Head of Customer Support
    4241Customer SupportSupport Specialist342024-06-1947,000Head of Customer Support
    4342Customer SupportSupport Specialist342023-05-1650,000Head of Customer Support
    4443MerchandisingHead of Merchandising22018-01-22155,000Chief Operating Officer
    4544MerchandisingBuyer432019-11-0975,000Head of Merchandising
    4645MerchandisingBuyer432023-09-1475,000Head of Merchandising
    4746MerchandisingBuyer432020-01-2179,000Head of Merchandising
    4847MerchandisingMerchandise Planner432021-06-2571,000Head of Merchandising
    4948FinanceHead of Finance12017-11-06175,000Chief Executive Officer
    5049FinanceFinancial Analyst482019-05-1381,000Head of Finance
    5150FinanceFinancial Analyst482024-05-0376,000Head of Finance
    5251FinanceAccountant482021-01-1581,000Head of Finance
    5352FinanceAccountant482021-09-3076,000Head of Finance
    5453EngineeringHead of Engineering12019-03-25205,000Chief Executive Officer
    5554EngineeringSenior Software Engineer532024-04-02180,000Head of Engineering
    5655EngineeringSenior Software Engineer532024-03-10163,000Head of Engineering
    5756EngineeringSoftware Engineer532021-04-27142,000Head of Engineering
    5857EngineeringSoftware Engineer532023-08-21130,000Head of Engineering
    5958EngineeringSoftware Engineer532024-06-14116,000Head of Engineering
    6059EngineeringSoftware Engineer532023-04-29137,000Head of Engineering
    6160EngineeringSoftware Engineer532024-11-29125,000Head of Engineering
    62
    63

    Loading the editor…

      ResultPress Check to compare J8:L16, J17:K17

      Mote checks your result

      Press Check. Each right cell becomes a firefly in your lantern.

      Step 3 · your sheet

      Excel
      The sheet for this level
      ABCDEFGHIJKLM
      1employee_iddepartmenttitlemanager_idhire_datesalarymanager_titledirect_reports
      21ExecutiveChief Executive Officer2016-03-01285,000no managerNo manager1
      32ExecutiveChief Operating Officer12017-01-09235,000Chief Executive OfficerManager not found0
      43SalesHead of Sales12018-04-16172,000Chief Executive OfficerLowest salary43,000
      54SalesAccount Executive32020-01-2172,000Head of SalesHighest salary285,000
      65SalesAccount Executive32023-05-2173,000Head of Sales
      76SalesAccount Executive32021-02-0476,000Head of Salesdepartmentheadcountpayrollaverage
      87SalesAccount Executive32021-06-1268,000Head of SalesEngineering81,198,000149,750
      98SalesAccount Executive32020-01-3183,000Head of SalesData & Analytics7756,000108,000
      109SalesSales Manager32018-07-01106,000Head of SalesSales9756,00084,000
      1110SalesSales Associate92023-08-0755,000Sales ManagerMarketing7664,00094,857
      1211SalesSales Associate92018-10-0251,000Sales ManagerOperations8587,00073,375
      1312MarketingHead of Marketing12019-02-04165,000Chief Executive OfficerCustomer Support9534,00059,333
      1413MarketingMarketing Manager122020-01-08107,000Head of MarketingExecutive2520,000260,000
      1514MarketingGrowth Marketer122019-04-2587,000Head of MarketingFinance5489,00097,800
      1615MarketingGrowth Marketer122022-08-1088,000Head of MarketingMerchandising5455,00091,000
      1716MarketingGrowth Marketer122020-04-0382,000Head of MarketingTotal605,959,000
      1817MarketingContent Strategist122019-04-1764,000Head of Marketing
      1918MarketingEmail Marketing Specialist122019-12-2771,000Head of MarketingManagers
      2019Data & AnalyticsHead of Data12020-08-03178,000Chief Executive OfficerWidest span
      2120Data & AnalyticsSenior Data Analyst192022-03-24117,000Head of DataMean salary
      2221Data & AnalyticsData Analyst192025-10-3191,000Head of DataMedian salary
      2322Data & AnalyticsData Analyst192023-02-2082,000Head of Data
      2423Data & AnalyticsData Analyst192021-02-2880,000Head of Data
      2524Data & AnalyticsData Analyst192025-03-1592,000Head of Data
      2625Data & AnalyticsAnalytics Engineer192025-07-03116,000Head of Data
      2726OperationsHead of Operations22018-09-10158,000Chief Operating Officer
      2827OperationsWarehouse Manager262024-12-2884,000Head of Operations
      2928OperationsLogistics Coordinator262022-05-2859,000Head of Operations
      3029OperationsLogistics Coordinator262021-05-0355,000Head of Operations
      3130OperationsLogistics Coordinator262021-03-2256,000Head of Operations
      3231OperationsLogistics Coordinator262024-07-2262,000Head of Operations
      3332OperationsInventory Specialist262020-12-1259,000Head of Operations
      3433OperationsInventory Specialist262020-10-2154,000Head of Operations
      3534Customer SupportHead of Customer Support22019-06-17128,000Chief Operating Officer
      3635Customer SupportSupport Team Lead342021-01-0372,000Head of Customer Support
      3736Customer SupportSupport Specialist352025-10-3150,000Support Team Lead
      3837Customer SupportSupport Specialist352023-02-0243,000Support Team Lead
      3938Customer SupportSupport Specialist352024-09-1349,000Support Team Lead
      4039Customer SupportSupport Specialist342024-11-2044,000Head of Customer Support
      4140Customer SupportSupport Specialist342020-04-0451,000Head of Customer Support
      4241Customer SupportSupport Specialist342024-06-1947,000Head of Customer Support
      4342Customer SupportSupport Specialist342023-05-1650,000Head of Customer Support
      4443MerchandisingHead of Merchandising22018-01-22155,000Chief Operating Officer
      4544MerchandisingBuyer432019-11-0975,000Head of Merchandising
      4645MerchandisingBuyer432023-09-1475,000Head of Merchandising
      4746MerchandisingBuyer432020-01-2179,000Head of Merchandising
      4847MerchandisingMerchandise Planner432021-06-2571,000Head of Merchandising
      4948FinanceHead of Finance12017-11-06175,000Chief Executive Officer
      5049FinanceFinancial Analyst482019-05-1381,000Head of Finance
      5150FinanceFinancial Analyst482024-05-0376,000Head of Finance
      5251FinanceAccountant482021-01-1581,000Head of Finance
      5352FinanceAccountant482021-09-3076,000Head of Finance
      5453EngineeringHead of Engineering12019-03-25205,000Chief Executive Officer
      5554EngineeringSenior Software Engineer532024-04-02180,000Head of Engineering
      5655EngineeringSenior Software Engineer532024-03-10163,000Head of Engineering
      5756EngineeringSoftware Engineer532021-04-27142,000Head of Engineering
      5857EngineeringSoftware Engineer532023-08-21130,000Head of Engineering
      5958EngineeringSoftware Engineer532024-06-14116,000Head of Engineering
      6059EngineeringSoftware Engineer532023-04-29137,000Head of Engineering
      6160EngineeringSoftware Engineer532024-11-29125,000Head of Engineering
      62
      63

      Loading the editor…

        ResultPress Check to compare H2:H61, J19:J22

        Mote checks your result

        Press Check. Each right cell becomes a firefly in your lantern.

        The lesson

        What the sheet holds

        HR’s export has one row per employee, with names removed:

        column holds
        A employee_id
        B, C department and title
        D manager_id: the employee_id of their manager, empty for the CEO
        E, F hire date and yearly salary

        Removing names is a good habit for any people data that leaves HR. It does not make the sheet anonymous, though: the only Executive earning 285,000 is obviously the CEO.

        Step 1: do the reporting lines hold together?

        Every manager_id should be another row’s employee_id. XLOOKUP finds it and returns that person’s title; its fourth argument decides what to show when nothing matches:

        G2   =IF(D2="","no manager",XLOOKUP(D2,$A$2:$A$61,$C$2:$C$61,"missing"))

        The IF in front handles the CEO, whose manager cell is empty. Then two counts and a range check:

        J2   =COUNTIF(G2:G61,"no manager")
        J3   =COUNTIF(G2:G61,"missing")
        J4   =MIN(F2:F61)
        J5   =MAX(F2:F61)

        One “no manager” and no “missing” means the org chart is complete. A monthly salary typed into a yearly column would show up in J4 as a number near 4,000.

        Step 2: headcount and payroll by department

        COUNTIF counts the rows whose department matches the label; SUMIF adds their salaries:

        J8   =COUNTIF($B$2:$B$61,I8)
        K8   =SUMIF($B$2:$B$61,I8,$F$2:$F$61)
        L8   =K8/J8

        Fill them down to row 16 and total in row 17. If the totals do not come to 60 people and the sum of column F, a department label is misspelled or missing.

        Step 3: span of control, mean and median

        Span of control is the number of people who report directly to someone. Turn the question around: an employee’s direct reports are the rows whose manager_id is their id.

        H2   =COUNTIF($D$2:$D$61,A2)

        Most rows show 0. The twelve that do not are the managers, and MAX gives the widest span, 7.

        Then the pay summary. The mean of all 60 salaries is 99,317, the median 81,000. The gap comes from a few senior salaries: the CEO, the COO and the department heads. For “what does a typical person earn”, the median is the honest number.

        Pitfalls

        • XLOOKUP without a fallback shows #N/A, which no COUNTIF of a word will catch.
        • Unlocked ranges slide when you fill down; lock every data range with $.
        • The average of a two-person group gives away both salaries to anyone who knows one. Keep small groups out of any report that goes beyond Finance and HR.

        Pick what may run on this site. You can change this any time from "Cookie settings" at the bottom of every page.