Count values with reference from a cell on a different worksheet

mcoetzee

New Member
Joined
Jul 12, 2016
Messages
5
I'm trying to count the number of shifts of employees by looking up by employee. The shift data is on a seperate worksheet. I would like to use a formula that refers to the cell for each employee and then finds the corresponding name and counts the number of shifts in the rows and columns on the next worksheet. I hope this makes sense.

Count problem.xlsx
AB
1Total number of shifts
2Employee 1
3Employee 2
4Employee 3
5Employee 4
6Employee 5
Datasheet1


Count problem.xlsx
ABCDEFG
1Row LabelsMondayTuesdayWednesdayThursdayFridayGrand Total
2Employee 17.57.57.57.530
3Employee 27.57.57.57.530
4Employee 37.57.57.57.57.537.5
5Employee 47.57.57.57.57.537.5
6Employee 57.57.57.57.57.537.5
Datasheet 2
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Try this:
Book1
ABC
1Total number of shifts
2Employee 14
3Employee 24
4Employee 35
5Employee 45
6Employee 55
7
DataSheet1
Cell Formulas
RangeFormula
B2:B6B2=SUMPRODUCT(--(DataSheet2!$A$2:$A$6=A2)*--(DataSheet2!$B$2:$F$6>1))
 
Upvote 0
Solution
@mcoetzee

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

IF you have MS365 you could also do it like this

21 09 20.xlsm
AB
1Total number of shifts
2Employee 14
3Employee 24
4Employee 35
5Employee 45
6Employee 55
Datasheet1
Cell Formulas
RangeFormula
B2:B6B2=COUNT(FILTER(Datasheet2!B$2:F$6,Datasheet2!A$2:A$6=A2,""))
 
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