How to exclude Saturdays and Sundays for calculation

James01

Board Regular
Joined
Oct 29, 2008
Messages
124
Hi

I have a formula as below

=
Code:
COUNTIF(Sheet1!$AA$1:$AA$3000,TEXT(NOW()-1,"mm/dd/yy"))

How do I get this formula to skip saturday and sundays?

Thanks
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Fazza

MrExcel MVP
Joined
May 17, 2006
Messages
9,368
Well, the formula counts days using NOW()-1 so is checking the day before.

To exclude Saturdays and Sundays is excluding results when the day that the formula executes is Sunday or Monday.

So, maybe something like this? HTH, Fazza

Code:
=IF(OR(MOD(TODAY(),7)={1,2}),0,COUNTIF(Sheet1!$AA$1:$AA$3000,TEXT(NOW()-1,"mm/dd/yy")))
 

James01

Board Regular
Joined
Oct 29, 2008
Messages
124
Hi

Thanks for the reply, I think it will work.

Just to clarify, yes the formula counts the cells having yesterdays date. NOw what I want is that if yesterday was Saturday or Sunday then the answer is 0. This is what the modified formula does, correct?

Thanks again

Cheers
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,167,994
Messages
5,856,699
Members
431,828
Latest member
kARTIK12345

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