How to print top 3 employees in a region in excel?

北慕城南 提交于 2020-08-26 09:21:21

问题


I have a table with three columns, region, emp_name, salaries.

I want to add one more column to this table in excel.

That new column should have either 1 or 0. 1 indicates one of the top3 employee based on salaries in a particular region.

For example, Region1 has 7 employees, namely emp1, emp2, so on emp7. emp2, emp4, emp7 have top 3 salaries.

So in the new column, emp2, emp4, emp7 must have 1 and others have 0. Let's say this table contains n number of regions.


回答1:


Put this in D2 and copy down:

=IF(C2>=AGGREGATE(14,7,$C$2:$C$1000/($A$2:$A$1000=A2),MIN(COUNTIF(A:A,A2),3)),1,0)




回答2:


Use a pivot table

  1. Insert the pivot using your whole range
  2. Add Region/Employee to Rows field (In that order)
  3. Add Salary (SUM) to the Values field
  4. Below Pivot Table Design = No Subtotals, No Grandtotals, Tabular Layout
  5. Select the drop down on Employee, Select Value Filter, Select Top 10...
  6. Complete form with Top 3 Items by Sum of Salary

If a region does not have 3 options, the top n will appear where n < 3.


If you need to use the 1, 0 option you could just do a vlookup on this table too. Note that a error will return if they are not on this list which means they are not top 3. You can use some error handling to convert this to 1, 0



来源:https://stackoverflow.com/questions/60938311/how-to-print-top-3-employees-in-a-region-in-excel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!