+ Reply to Thread
Results 1 to 4 of 4

COUNTIFS dependent on date being on weekday or weekend

Hybrid View

  1. #1
    Registered User
    Join Date
    09-19-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    10

    COUNTIFS dependent on date being on weekday or weekend

    I am trying to count the number of occurrences of a value >0 and <=10 from C3:C9330, but I would like to count them dependent on whether the recorded date in B3:B9330 is a weekday or a weekend, i.e. count the number of times a value of 0-10 occurs on weekdays, and how many time it occurs on weekends. I have tried COUNTIFS formulas but I can't seem to get the criteria correct to count only if the date in column B is a weekday (or a weekend). Does anyone know how to do this?

    Cheers.

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: COUNTIFS dependent on date being on weekday or weekend

    Try these...

    For weekdays (Mon - Fri):

    =SUMPRODUCT(--(WEEKDAY(B3:B9330,2)<6),--(C3:C9330>0),--(C3:C9330<=10))

    For weekends (Sat - Sun):

    =SUMPRODUCT(--(WEEKDAY(B3:B9330,2)>5),--(C3:C9330>0),--(C3:C9330<=10))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    09-19-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: COUNTIFS dependent on date being on weekday or weekend

    Thanks for the reply, but it's not what I'm looking for.

    I've attached sample data to try explain it better. Essentially I'm looking to count the number of times the value is between 0-10 in column C but dependent on the date in column B being a weekday or a weekend, and then to do this for values between 10-20, 20-30, etc.

    Thanks again for the help.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: COUNTIFS dependent on date being on weekday or weekend

    Quote Originally Posted by weldo View Post
    Thanks for the reply, but it's not what I'm looking for.
    Hmmm...

    That's what you asked for!

    You need to change your interval table to be something like this...

    Data Range
    F
    G
    H
    I
    1
    Greater
    Less Than
    2
    Than
    Or Equal
    Weekday
    Weekend
    3
    0
    10
    170
    36
    4
    10
    20
    116
    24
    5
    20
    30
    114
    23
    6
    30
    40
    124
    3
    7
    40
    50
    50
    10


    This formula entered in H3 and copied down:

    =SUMPRODUCT(--(WEEKDAY(B$3:B$1002,2)<6),--(C$3:C$1002>F3),--(C$3:C$1002<=G3))

    This formula entered in I3 and copied down:

    =SUMPRODUCT(--(WEEKDAY(B$3:B$1002,2)>5),--(C$3:C$1002>F3),--(C$3:C$1002<=G3))

    If there might be empty cells in the date range then you'll have to add this test to each formula:

    --(B$3:B$1002<>"")
    Last edited by Tony Valko; 03-26-2014 at 04:12 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] help please to identify and display 'WEEKDAY' or 'WEEKEND'
    By vin1602 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-06-2013, 06:30 AM
  2. [SOLVED] calculate turn around times range of times for weekday and weekend
    By xrayexceller in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 07-28-2013, 02:22 PM
  3. [SOLVED] Extracting data depending on whether a date is a weekday or weekend
    By weldo in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-19-2012, 11:24 AM
  4. Replies: 2
    Last Post: 12-09-2011, 07:11 AM
  5. Calculating Weeks, Weekday nights and Weekend nights
    By bngguy in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 10-26-2010, 01:41 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1