Top 25 Companies

zinah

Active Member
Joined
Nov 28, 2018
Messages
368
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a monthly/quarterly report that shows top 25 companies that we gained employees from. What I need to build a dynamic list that can be refreshed whenever I dump the updated data file and formula can be refreshed to update my list. I know using some formulas like rank, filter and other great formulas can be helpful but not sure how to begin. Below is a sample table:

What I need to accomplish is: when I update the top 25 to any number i.e. 30 or 10, then what will happen is a list to be generated (just like when we use filter function) with a list that is showing the top 25 companies that we gained employees from (based on count of Job Req) that is sorted by largest number


Job Req ID
Previous company​
Department​
JR100​
AAA​
HR​
Top​
25​
JR200​
BBB​
Finance​
Department​
Company​
Count of Job Req​
JR300​
CCC​
Operations​
HR​
AAA​
3​
JR400​
DDD​
IT​
Finance​
AAA​
0​
JR500​
EEE​
HR​
Operations​
AAA​
0​
JR600​
FFF​
Finance​
IT​
AAA​
1​
JR700​
GGG​
IT​
JR800​
HHH​
Operations​
JR900​
AAA​
Legal​
JR1000​
BBB​
Customer Service​
JR1100​
CCC​
HR​
JR1200​
DDD​
Finance​
JR1300​
EEE​
Operations​
JR1400​
FFF​
IT​
JR1500​
GGG​
HR​
JR1600​
HHH​
Finance​
JR1700​
AAA​
IT​
JR1800​
BBB​
Operations​
JR1900​
CCC​
Legal​
JR2000​
DDD​
Customer Service​
JR2100​
AAA​
HR​
JR2200​
BBB​
Finance​
JR2300​
CCC​
Operations​
JR2400​
DDD​
IT​
JR2500​
EEE​
HR​
JR2600​
FFF​
Finance​
JR2700​
GGG​
IT​
JR2800​
HHH​
Operations​
JR2900​
AAA​
Legal​
JR3000​
BBB​
Customer Service​
JR3100​
CCC​
HR​
JR3200​
DDD​
Finance​
JR3300​
EEE​
Operations​
JR3400​
FFF​
IT​
JR3500​
GGG​
HR​
JR3600​
HHH​
Finance​
JR3700​
AAA​
HR​
JR3800​
BBB​
Finance​
JR3900​
CCC​
Operations​
JR4000​
DDD​
IT​
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Try This:
Book1
ABCDEFGHIJKL
1Job Req IDPrevious companyDepartmentCountifsRank
2JR100AAAHR121Top25
3JR200BBBFinance122No.DepartmentCompanyCount of Job Req
4JR300CCCOperations1231HRAAA3
5JR400DDDIT1242FinanceBBB3
6JR500EEEHR1253OperationsCCC3
7JR600FFFFinance1264ITDDD3
8JR700GGGIT1275HRAAA2
9JR800HHHOperations1286FinanceBBB2
10JR900AAALegal1297OperationsCCC2
11JR1000BBBCustomer Service1308ITDDD2
12JR1100CCCHR1319HREEE2
13JR1200DDDFinance13210FinanceFFF2
14JR1300EEEOperations13311ITGGG2
15JR1400FFFIT13412OperationsHHH2
16JR1500GGGHR13513LegalAAA2
17JR1600HHHFinance13614Customer ServiceBBB2
18JR1700AAAIT13715HRCCC2
19JR1800BBBOperations13816FinanceDDD2
20JR1900CCCLegal13917OperationsEEE2
21JR2000DDDCustomer Service14018ITFFF2
22JR2100AAAHR2519HRGGG2
23JR2200BBBFinance2620FinanceHHH2
24JR2300CCCOperations2721HRAAA1
25JR2400DDDIT2822FinanceBBB1
26JR2500EEEHR2923OperationsCCC1
27JR2600FFFFinance21024ITDDD1
28JR2700GGGIT21125HREEE1
29JR2800HHHOperations21226   
30JR2900AAALegal21327   
31JR3000BBBCustomer Service21428   
32JR3100CCCHR21529   
33JR3200DDDFinance21630   
34JR3300EEEOperations21731   
35JR3400FFFIT21832   
36JR3500GGGHR21933   
37JR3600HHHFinance22034   
38JR3700AAAHR3135   
39JR3800BBBFinance3236   
40JR3900CCCOperations3337   
41JR4000DDDIT3438   
42
43
Sheet1
Cell Formulas
RangeFormula
D2:D41D2=COUNTIFS($B$2:B2,B2,$C$2:C2,C2)
E2:E41E2=RANK(D2,$D$2:$D$41,0)+COUNTIF($D$2:D2,D2)-1
H4:H41H4=IFNA(INDEX($B$2:$D$41,MATCH(1,((ROW()-3)=$E$2:$E$41)*($E$2:$E$41<=$I$2),0),2),"")
I4:I41I4=IFNA(INDEX($B$2:$D$41,MATCH(1,((ROW()-3)=$E$2:$E$41)*($E$2:$E$41<=$I$2),0),1),"")
J4:J41J4=IFNA(INDEX($B$2:$D$41,MATCH(1,((ROW()-3)=$E$2:$E$41)*($E$2:$E$41<=$I$2),0),3),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Another possibility.
+Fluff 1.xlsm
ABCDEFGH
1Job Req IDPrevious companyDepartmentCountifs
2JR100AAAHR3Top25
3JR200BBBFinance3DepartmentCompanyCount of Job Req
4JR300CCCOperations3HRAAA3
5JR400DDDIT3FinanceBBB3
6JR500EEEHR2OperationsCCC3
7JR600FFFFinance2ITDDD3
8JR700GGGIT2HREEE2
9JR800HHHOperations2FinanceFFF2
10JR900AAALegal2ITGGG2
11JR1000BBBCustomer Service2OperationsHHH2
12JR1100CCCHR2LegalAAA2
13JR1200DDDFinance2Customer ServiceBBB2
14JR1300EEEOperations2HRCCC2
15JR1400FFFIT2FinanceDDD2
16JR1500GGGHR2OperationsEEE2
17JR1600HHHFinance2ITFFF2
18JR1700AAAIT1HRGGG2
19JR1800BBBOperations1FinanceHHH2
20JR1900CCCLegal1ITAAA1
21JR2000DDDCustomer Service1OperationsBBB1
22JR2100AAAHR3LegalCCC1
23JR2200BBBFinance3Customer ServiceDDD1
24JR2300CCCOperations3
25JR2400DDDIT3
26JR2500EEEHR2
27JR2600FFFFinance2
28JR2700GGGIT2
29JR2800HHHOperations2
30JR2900AAALegal2
31JR3000BBBCustomer Service2
32JR3100CCCHR2
33JR3200DDDFinance2
34JR3300EEEOperations2
35JR3400FFFIT2
36JR3500GGGHR2
37JR3600HHHFinance2
38JR3700AAAHR3
39JR3800BBBFinance3
40JR3900CCCOperations3
41JR4000DDDIT3
Master
Cell Formulas
RangeFormula
F4:H28F4=IFERROR(INDEX(SORT(UNIQUE(B2:D41),3,-1),SEQUENCE(G2),{2,1,3}),"")
D2:D41D2=COUNTIFS($B:B,B2,$C:C,C2)
Dynamic array formulas.
 
Upvote 0
Solution
Here is an alternative means by using Power Query. Mcode follows

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Job Req ID", type text}, {"Previous company", type text}, {"Department", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Department", "Previous company"}, {{"Count", each Table.RowCount(_), Int64.Type}})
in
    #"Grouped Rows"

Book2
ABC
2HRAAA3
3FinanceBBB3
4OperationsCCC3
5ITDDD3
6HREEE2
7FinanceFFF2
8ITGGG2
9OperationsHHH2
10LegalAAA2
11Customer ServiceBBB2
12HRCCC2
13FinanceDDD2
14OperationsEEE2
15ITFFF2
16HRGGG2
17FinanceHHH2
18ITAAA1
19OperationsBBB1
20LegalCCC1
21Customer ServiceDDD1
Table1
 
Upvote 0
Try This:
Book1
ABCDEFGHIJKL
1Job Req IDPrevious companyDepartmentCountifsRank
2JR100AAAHR121Top25
3JR200BBBFinance122No.DepartmentCompanyCount of Job Req
4JR300CCCOperations1231HRAAA3
5JR400DDDIT1242FinanceBBB3
6JR500EEEHR1253OperationsCCC3
7JR600FFFFinance1264ITDDD3
8JR700GGGIT1275HRAAA2
9JR800HHHOperations1286FinanceBBB2
10JR900AAALegal1297OperationsCCC2
11JR1000BBBCustomer Service1308ITDDD2
12JR1100CCCHR1319HREEE2
13JR1200DDDFinance13210FinanceFFF2
14JR1300EEEOperations13311ITGGG2
15JR1400FFFIT13412OperationsHHH2
16JR1500GGGHR13513LegalAAA2
17JR1600HHHFinance13614Customer ServiceBBB2
18JR1700AAAIT13715HRCCC2
19JR1800BBBOperations13816FinanceDDD2
20JR1900CCCLegal13917OperationsEEE2
21JR2000DDDCustomer Service14018ITFFF2
22JR2100AAAHR2519HRGGG2
23JR2200BBBFinance2620FinanceHHH2
24JR2300CCCOperations2721HRAAA1
25JR2400DDDIT2822FinanceBBB1
26JR2500EEEHR2923OperationsCCC1
27JR2600FFFFinance21024ITDDD1
28JR2700GGGIT21125HREEE1
29JR2800HHHOperations21226   
30JR2900AAALegal21327   
31JR3000BBBCustomer Service21428   
32JR3100CCCHR21529   
33JR3200DDDFinance21630   
34JR3300EEEOperations21731   
35JR3400FFFIT21832   
36JR3500GGGHR21933   
37JR3600HHHFinance22034   
38JR3700AAAHR3135   
39JR3800BBBFinance3236   
40JR3900CCCOperations3337   
41JR4000DDDIT3438   
42
43
Sheet1
Cell Formulas
RangeFormula
D2:D41D2=COUNTIFS($B$2:B2,B2,$C$2:C2,C2)
E2:E41E2=RANK(D2,$D$2:$D$41,0)+COUNTIF($D$2:D2,D2)-1
H4:H41H4=IFNA(INDEX($B$2:$D$41,MATCH(1,((ROW()-3)=$E$2:$E$41)*($E$2:$E$41<=$I$2),0),2),"")
I4:I41I4=IFNA(INDEX($B$2:$D$41,MATCH(1,((ROW()-3)=$E$2:$E$41)*($E$2:$E$41<=$I$2),0),1),"")
J4:J41J4=IFNA(INDEX($B$2:$D$41,MATCH(1,((ROW()-3)=$E$2:$E$41)*($E$2:$E$41<=$I$2),0),3),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
Thank you so much, I'm going to explore your formulas and see if they work, I really appreciate your prompt help!
 
Upvote 0
Another possibility.
+Fluff 1.xlsm
ABCDEFGH
1Job Req IDPrevious companyDepartmentCountifs
2JR100AAAHR3Top25
3JR200BBBFinance3DepartmentCompanyCount of Job Req
4JR300CCCOperations3HRAAA3
5JR400DDDIT3FinanceBBB3
6JR500EEEHR2OperationsCCC3
7JR600FFFFinance2ITDDD3
8JR700GGGIT2HREEE2
9JR800HHHOperations2FinanceFFF2
10JR900AAALegal2ITGGG2
11JR1000BBBCustomer Service2OperationsHHH2
12JR1100CCCHR2LegalAAA2
13JR1200DDDFinance2Customer ServiceBBB2
14JR1300EEEOperations2HRCCC2
15JR1400FFFIT2FinanceDDD2
16JR1500GGGHR2OperationsEEE2
17JR1600HHHFinance2ITFFF2
18JR1700AAAIT1HRGGG2
19JR1800BBBOperations1FinanceHHH2
20JR1900CCCLegal1ITAAA1
21JR2000DDDCustomer Service1OperationsBBB1
22JR2100AAAHR3LegalCCC1
23JR2200BBBFinance3Customer ServiceDDD1
24JR2300CCCOperations3
25JR2400DDDIT3
26JR2500EEEHR2
27JR2600FFFFinance2
28JR2700GGGIT2
29JR2800HHHOperations2
30JR2900AAALegal2
31JR3000BBBCustomer Service2
32JR3100CCCHR2
33JR3200DDDFinance2
34JR3300EEEOperations2
35JR3400FFFIT2
36JR3500GGGHR2
37JR3600HHHFinance2
38JR3700AAAHR3
39JR3800BBBFinance3
40JR3900CCCOperations3
41JR4000DDDIT3
Master
Cell Formulas
RangeFormula
F4:H28F4=IFERROR(INDEX(SORT(UNIQUE(B2:D41),3,-1),SEQUENCE(G2),{2,1,3}),"")
D2:D41D2=COUNTIFS($B:B,B2,$C:C,C2)
Dynamic array formulas.
Loved your approach it's the same approach that I'm looking for, using the cool formulas of office 365. The formulas worked for my example data, however, what if I have the columns not in the order of A, B, C, D, like below (G, BR,BA, and CL)?

G​
BR​
BA​
CL​
Job Req ID
Previous company​
Department​
Rank​
 
Upvote 0
Here is an alternative means by using Power Query. Mcode follows

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Job Req ID", type text}, {"Previous company", type text}, {"Department", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Department", "Previous company"}, {{"Count", each Table.RowCount(_), Int64.Type}})
in
    #"Grouped Rows"

Book2
ABC
2HRAAA3
3FinanceBBB3
4OperationsCCC3
5ITDDD3
6HREEE2
7FinanceFFF2
8ITGGG2
9OperationsHHH2
10LegalAAA2
11Customer ServiceBBB2
12HRCCC2
13FinanceDDD2
14OperationsEEE2
15ITFFF2
16HRGGG2
17FinanceHHH2
18ITAAA1
19OperationsBBB1
20LegalCCC1
21Customer ServiceDDD1
Table1
Thank you so much for taking time and providing me with alternative approach, I'm going to test your approach on my real data and update you if I have any further questions.
 
Upvote 0
what if I have the columns not in the order of A, B, C, D, like below (G, BR,BA, and CL)?
You'ld probably be better off with power query or a macro.
 
Upvote 0
You'ld probably be better off with power query or a macro.
I figured out a way to include the required columns that I mentioned earlier which is:
Excel Formula:
=IFERROR(INDEX(SORT(UNIQUE(B3:AN42),3,-1),SEQUENCE(AQ3),{1,18,39}),"")

But when I changed the columns from {2,1,3} to {1,18,39}, I need to change this part of formula as well (SORT(UNIQUE($BA:$CM),3,-1), however, not sure what should I replace "3" with? any recommendations?

Below is the results I got:

AQ3 is the top criteria which is 20 in my example below​
20​
BBB​
Finance​
3​
CCC​
Operations​
3​
DDD​
IT​
3​
EEE​
HR​
2​
FFF​
Finance​
2​
GGG​
IT​
2​
HHH​
Operations​
2​
AAA​
Legal​
2​
BBB​
Customer Service​
2​
CCC​
HR​
2​
DDD​
Finance​
2​
EEE​
Operations​
2​
FFF​
IT​
2​
GGG​
HR​
2​
HHH​
Finance​
2​
AAA​
IT​
1​
BBB​
Operations​
1​
CCC​
Legal​
1​
DDD​
Customer Service​
1​
AAA​
HR​
3​
 
Last edited:
Upvote 0
The 3 needs to be changed to the column index that needs to be sorted.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top