Table:
0
A
B
C
D
1
department id
name
head
employee id
2
1
General Medicine
4
3
2
Surgery
7
4
3
Psychiatry
9

Questions and formulas:
Question: Which department has the largest number of employees?
Formula: TAKE(SORT(SUMMARIZE(A1,SUMX(D1)), 2, -1), 1)
Formula2: TAKE(SORT(SUMMARIZE(A2:A4,SUMX(D2:D4)), 2, -1), 1)
Level: hard
Question: Find the department with the most employees.
Formula: TAKE(SORT(SUMMARIZE(A1,SUMX(D1)), 2, -1), 1)
Formula2: TAKE(SORT(SUMMARIZE(A2:A4,SUMX(D2:D4)), 2, -1), 1)
Level: hard
Question: What is the employee id whose department has the least number of employees?
Formula: LET(a,HSTACK(D1,A1),b,A1,c,CHOOSECOLS(TAKE(SORT(SUMMARIZE(A1,SUMX(D1)), 2, 1), 1),1),UNIQUE(FILTER(a,NOT(ISNA(XLOOKUP(b,c,c))))))
Formula2: LET(a,HSTACK(D2:D4,A2:A4),b,A2:A4,c,CHOOSECOLS(TAKE(SORT(SUMMARIZE(A2:A4,SUMX(D2:D4)), 2, 1), 1),1),UNIQUE(FILTER(a,NOT(ISNA(XLOOKUP(b,c,c))))))
Level: hard
Question: Department which has the highest number of employees within it.
Formula: TAKE(SORT(SUMMARIZE(A1,SUMX(D1)), 2, -1), 1)
Formula2: TAKE(SORT(SUMMARIZE(A2:A4,SUMX(D2:D4)), 2, -1), 1)
Level: hard
Question: Department with the highest number of employees.
Formula: TAKE(SORT(SUMMARIZE(A1,SUMX(D1)), 2, -1), 1)
Formula2: TAKE(SORT(SUMMARIZE(A2:A4,SUMX(D2:D4)), 2, -1), 1)
Level: hard
Question: the department having the most employees.
Formula: TAKE(SORT(SUMMARIZE(A1,SUMX(D1)), 2, -1), 1)
Formula2: TAKE(SORT(SUMMARIZE(A2:A4,SUMX(D2:D4)), 2, -1), 1)
Level: hard
Question: Department where most employees work.
Formula: TAKE(SORT(SUMMARIZE(A1,SUMX(D1)), 2, -1), 1)
Formula2: TAKE(SORT(SUMMARIZE(A2:A4,SUMX(D2:D4)), 2, -1), 1)
Level: hard