ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Countif? (https://www.excelbanter.com/excel-discussion-misc-queries/454049-countif.html)

Milo Bloom

Countif?
 
Hello, I want to count dates if they are weekday or weekend
Col A is Dates I.E. 1 Apr 18 to 30 Apr 18
Col B is Numbers normally 65 to 200
I want to count the number of weekday and weekend in Col B

Thanks in Advance

Milo

Claus Busch

Countif?
 
Hi Milo,

Am Fri, 6 Apr 2018 20:25:52 +0100 schrieb Milo Bloom:

Hello, I want to count dates if they are weekday or weekend
Col A is Dates I.E. 1 Apr 18 to 30 Apr 18
Col B is Numbers normally 65 to 200
I want to count the number of weekday and weekend in Col B


try:
=SUMPRODUCT(N(WEEKDAY(A1:A30,2)<6))
or
=SUMPRODUCT(--(WEEKDAY(A1:A31,2)<6),--(A1:A310))
for weekdays
and
=SUMPRODUCT(N(WEEKDAY(A1:A30,2)5))
or
=SUMPRODUCT(--(WEEKDAY(A1:A31,2)5),--(A1:A310))
for weekends



Regards
Claus B.
--
Windows10
Office 2016

Milo Bloom

Weekdays & Weekends
 
Ok Thanks for that info, helped a bunch, and I cabbage d up something that sort of works. Is there any way to count single days? I.E Monday or Tuesday or Sunday, not just Weekdays or Weekends. This works to average Weekdays or Weekends.
=IF(SUMPRODUCT(N(WEEKDAY($A$2:$A$34,2)<6)),AVERAGE ($B$2:$B$30))
^
|
Changing this to other than 5 has
no impact.
That is Monday being "1" Tuesday "2"....

Thanks for the help everyone! :-)

Milo

Milo Bloom

Ok I got it :-)

=AVERAGE(IF(WEEKDAY($A$2:$A$32)=2,$D$2:$D$32))
^
|
Change as needed for desired day of week,
Sunday = 1. Mon =2 .......Sat = 7

A column is dates May 1 to May 31
D Column is Data


All times are GMT +1. The time now is 02:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com