Count Rows based multiple condition in column

B_Siva

New Member
Joined
Feb 8, 2009
Messages
14
Office Version
  1. 2007
Platform
  1. Windows
Hi,
I would like to count number of day a employee work >4:50 pm on weekday and >11:50 am on weekend.
Count only the out time.
Below formula does give me the right answer.
COUNTIFS(C6:P6,">6:45 PM",C4:P4,"<>Sat",C4:P4,"<>Sun",C5:P5,"=Out"),0)

1609669919745.png


Pls help.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
*Below formula does not give give me the right answer*
COUNT(COUNTIFS(C6:P6,">6:45 PM",C5:P5,"=Out",C4:P4,"<>Sat",C4:P4,"<>Sun"),0)
 
Upvote 0
Can you update your Account details (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’)

Can you give us the sample data and expected results withXL2BB? Providing sample data that way makes it easier for helpers by not having to manually type out sample data to test with. Also, your image is quite hard to read anyway.
 
Upvote 0
Employee Number of day OT.xlsx
ABCDEFGHIJKLMNOPQR
1
2
3Employee IDEmployee Name1-Jan-212-Jan-213-Jan-214-Jan-215-Jan-216-Jan-217-Jan-21No of Weekday OT (>6:45 pm)No of Weekend OT (>11:50 am)
4MonTueWedThuFriSatSun
5InOutInOutInOutInOutInOutInOutInOut
6123456ABCD7:25 AM7:00 PM7:25 AM7:00 PM7:25 AM5:00 PM7:25 AM7:00 PM7:25 AM5:00 PM7:25 AM11:00 AM7:25 AM5:00 PM22
7correct answer 3correct answer 1
8
Sheet1
Cell Formulas
RangeFormula
Q6Q6=COUNT(COUNTIFS($C6:$P6,">6:45 PM",$C$5:$P$5,"=Out",$C$4:$P$4,"<>Sat",$C$4:$P$4,"<>Sun"),0)
R6R6=COUNT(COUNTIFS($C6:$P6,">11:50 AM",$C$5:$P$5,"=Out",$C$4:$P$4,"Sat",$C$4:$P$4,"Sun"),0)
 
Upvote 0
The issues I tried and seem to help. Please wait for one of the Experts to confirm.

Merged cells are evil when used in formulas.
Use SUM instead of COUNT for the final count
In countifs using {"Sat","Sun"} tells excel you want either option.

Book1
ABCDEFGHIJKLMNOPQR
1
2
3Employee IDEmployee Name1/1/211/2/211/3/211/4/211/5/211/6/211/7/21No of Weekday OT (>6:45 pm)No of Weekend OT (>11:50 am)
4MonMonTueTueWedWedThuThuFriFriSatSatSunSun
5InOutInOutInOutInOutInOutInOutInOut
6123456ABCD7:25 AM7:00 PM7:25 AM7:00 PM7:25 AM5:00 PM7:25 AM7:00 PM7:25 AM5:00 PM7:25 AM11:00 AM7:25 AM5:00 PM31
7correct answer 3correct answer 1
Sheet1
Cell Formulas
RangeFormula
Q6Q6=SUM(COUNTIFS($C6:$P6,">6:45 PM",$C$5:$P$5,"Out",$C$4:$P$4,"<>Sat",$C$4:$P$4,"<>Sun"))
R6R6=SUM(COUNTIFS($C6:$P6,">11:50 AM",$C$5:$P$5,"Out",$C$4:$P$4,{"Sat","Sun"}))
 
Upvote 0
It is fine to keep the merged cells if you want. Notice the offset ranges.

21 01 04.xlsm
CDEFGHIJKLMNOPQR
1
2
31-Jan-212-Jan-213-Jan-214-Jan-215-Jan-216-Jan-217-Jan-21No of Weekday OT (>6:45 pm)No of Weekend OT (>11:50 am)
4MonTueWedThuFriSatSun
5InOutInOutInOutInOutInOutInOutInOut
67:25:00 AM7:00:00 PM7:25:00 AM7:00:00 PM7:25:00 AM5:00:00 PM7:25:00 AM7:00:00 PM7:25:00 AM5:00:00 PM7:25:00 AM11:00:00 AM7:25:00 AM5:00:00 PM31
Counting
Cell Formulas
RangeFormula
Q6Q6=COUNTIFS(D6:P6,">6:45 PM",D$5:P$5,"=Out",C$4:O$4,"<>S*")
R6R6=COUNTIFS(D6:P6,">11:50 AM",D$5:P$5,"=Out",C$4:O$4,"S*")
 
Last edited:
Upvote 0
Solution

Forum statistics

Threads
1,215,523
Messages
6,125,318
Members
449,218
Latest member
Excel Master

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