On one sheet, I have a table with an employee name in column A and their associated rank in column B. On a separate sheet, I have a blank master schedule with all possible shifts in column B and days of the week in row 1. I would like to be able to type the employee's name in the cell associated with the shift they will be working. After filling in the schedule, I would like excel to "add" up the ranks to get a sum total for each day. If there are empty cells, they would be given a value of "0". I made it work using the following formula:
=SUM(COUNTIF(C2:C19,{"A","B","C"})*{1,2,3})
where A, B, and C represent the employees' names and 1, 2, and 3 represent their associated ranks, but admittedly that was before I introduced the possibility of blank cells. The problem there is that I have to freetype it all, and if a rank changes, or an employee changes, I have to edit everything individually. I'm really hoping there's a way to reference my table and I'm just not getting it?
Any help would be greatly appreciated!!
Create dynamic ranges names for the employee names and the ranks, for example
Names =Sheet1!$A$2:INDEX(Sheet1!$A:$A,COUNTA(Sheet1!$A:$A))
Ranks =OFFSET(Names,0,1)
On the other sheet, use the formula
=SUM(COUNTIF(C2:C19,Names)*Ranks)
This is an array formula and must be confirmed with Ctrl-Shift-Enter
You can now add new names to the employee list...
... and use that name in the shift roster. The formula will show the correct result.
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句