Formula

Bob1982

New Member
Joined
Apr 3, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello

I'm new here so hopefully I have posted this in the correct place. I am currently making a rota at work and want to count how many weekends employees are working. Is there a formula which identifies certain cells containing a particular text and making that equal the value of 1 which I can add together with other cells for that year, giving me the amount of weekends worked.

For example:

(if H6 or I6 contains a D or an N that equals 1) + (if O6 or P6 contains a D or an N that equals 1) = the amount of weekends worked if D or N are mentioned in those cells.


I don't know if that make sense or not, or I could just be other thinking it and its really simple. I don't know, but any help is really appreciated.
 

Attachments

  • 1.png
    1.png
    12.9 KB · Views: 13

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
various ways to do that
the way you suggest

I would use
countif(C6:ZZ6, "D") + countif(C6:ZZ6, "N")

I'll put something together to show

change the range to your full year
 
Upvote 0
Cell Formulas
RangeFormula
C1:P1C1=B1+1
Q6Q6=COUNTIF(B6:P6,"D")+COUNTIF(B6:P6,"N")
R6R6=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(B1&":"&P1)))>=6))
S6S6=NETWORKDAYS.INTL(B1,P1,"1111100")


there are ways just to count using the dates and not the codes , if needed , BUT i assume the codes are used to may an person working
 
Upvote 0
I'm thinking that an individual's weekend count will be +1 for the Saturday, or the Sunday or both, of the the same weekend?

In that case then, give or take any need to adjust for actual ranges, maybe like.....

Book1
ABCDEFGHIJKLMNOPQR
2MonTueWedThuFriSatSunMonTueWedThuFriSatSunMonTue
3
4
5NameWeekends01-Aug02-Aug03-Aug04-Aug05-Aug06-Aug07-Aug08-Aug09-Aug10-Aug11-Aug12-Aug13-Aug14-Aug15-Aug16-Aug
6Employee 11DDDDNNN
7Employee 21DDNDDN
8Employee 32DDDNNNN
9Employee 42DDNN
10Employee 52DNN
11Employee 60DDDDDN
12
Sheet6
Cell Formulas
RangeFormula
C2:R2C2=TEXT(C5,"ddd")
D5:R5D5=C5+1
B6:B11B6=SUMPRODUCT((C6:ZY6>"")*(WEEKDAY($C$5:$ZY$5,2)>5))-SUMPRODUCT((C6:ZY6>"")*(D6:ZZ6>"")*(WEEKDAY($C$5:$ZY$5,2)=6)*(WEEKDAY($D$5:$ZZ$5,2)=7))
 
Upvote 0

Forum statistics

Threads
1,215,586
Messages
6,125,683
Members
449,249
Latest member
ExcelMA

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