Sickness Occasions excluding weekends

Cooki

Board Regular
Joined
Jul 31, 2018
Messages
77
Im having trouble trying to exclude the weekdends from my sickness occasions formula

{=SUM(IF(FREQUENCY(IF(B1:B365>=(A1-365),IF(D1:D365="Sick",ROW(D1:D365))),IF(B1:B365>=(A1-365),IF(D1:D365<>"Sick",ROW(D1:D365)))),1))}

Sick database looks like

Date
01/01/19 Sick
02/01/19 Sick
03/01/19 Sick
04/01/19 Sick
05/01/19 Sick

Can covering it in an IF, tried Networkdays but none work
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,424
Office Version
  1. 2019
Try changing part of the the formula to

...IF(AND(D1:D365="Sick",WEEKDAY(D1:D365)<>1,WEEKDAY(D1:D365)<>6)...
 

Cooki

Board Regular
Joined
Jul 31, 2018
Messages
77
Try changing part of the the formula to

...IF(AND(D1:D365="Sick",WEEKDAY(D1:D365)<>1,WEEKDAY(D1:D365)<>6)...


Nope it dd not work

=SUM(IF(FREQUENCY(IF(AND(D1:D365="Sick",WEEKDAY(D1:D365)<>1,WEEKDAY(D1:D365)<>6)*B1:B365>=(A1-365),IF(D1:D365="Sick",ROW(D1:D365))),IF(B1:B365>=(A1-365),IF(D1:D365<>"Sick",ROW(D1:D365)))),1))

Getting #VALUE
 

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,424
Office Version
  1. 2019
Doesnt solve your problem but I just realsed this

Code:
WEEKDAY(D1:D365)<>6

should be

Code:
WEEKDAY(D1:D365)<>7
 
Last edited:

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,424
Office Version
  1. 2019

ADVERTISEMENT

Another guess

=SUM(IF(FREQUENCY(IF(B1:B365>=(A1-365),IF((D1:D365="Sick")*(WEEKDAY(D1:D365)<>1)*(WEEKDAY(D1:D365)<>7),ROW(D1:D365))),IF(B1:B365>=(A1-365),IF(D1:D365<>"Sick",ROW(D1:D365)))),1))
 

Tetra201

MrExcel MVP
Joined
Oct 14, 2016
Messages
3,711
Try

=SUM(IF(FREQUENCY(IF(B1:B365>=(A1-365),IF((D1:D365="Sick")*(WEEKDAY(B1:B365,2)<6),ROW(D1:D365))),IF(B1:B365>=(A1-365),IF((D1:D365<>"Sick")*(WEEKDAY(B1:B365,2)<6),ROW(D1:D365)))),1))
 

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,424
Office Version
  1. 2019

ADVERTISEMENT

Got me columns wrong

Try changing part of the the formula to

...IF(AND(D1:D365="Sick",WEEKDAY(C1:C365)<>1,WEEKDAY(C1:C365)<>6)...
 

Cooki

Board Regular
Joined
Jul 31, 2018
Messages
77
YESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS

Finally been working on this for a long time and you have solved my issue

Thank you works like a dream
 

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,424
Office Version
  1. 2019
Well i dont know whose solution you're referring to but if its mine I still think mine is wrong

I think it should be this

...IF(AND(D1:D365="Sick",WEEKDAY(C1:C365)<>1,WEEKDAY(C1:C365)<>7)...
 

Cooki

Board Regular
Joined
Jul 31, 2018
Messages
77
Well i dont know whose solution you're referring to but if its mine I still think mine is wrong

I think it should be this

...IF(AND(D1:D365="Sick",WEEKDAY(C1:C365)<>1,WEEKDAY(C1:C365)<>7)...

Oh did not notice Tetra put a post up.

Tetra201 one works like a dream

Much appreciated to both of you taking the time to have a go
 

Forum statistics

Threads
1,148,108
Messages
5,744,874
Members
423,907
Latest member
zerocool88

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
Top