+ Reply to Thread
Results 1 to 8 of 8

Array to count how many days within a range are greater than 5

  1. #1
    Valued Forum Contributor ron2k_1's Avatar
    Join Date
    09-30-2009
    Location
    Not the USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    606

    Array to count how many days within a range are greater than 5

    If I need a count of how many days within a range are not saturdays or sundays, why wouldn't this work:

    Please Login or Register  to view this content.
    PS: Preferably if I don't have to use ATP formulas

    Thanks

    EDIT: Bear in mind that some of the cells in the range may be blank. I gotten away for now given that there weren't many cells in the range with the following, but for educational purposes, I'd still like to learn additional ways:
    Please Login or Register  to view this content.
    Last edited by ron2k_1; 09-04-2011 at 12:56 AM.
    Ron
    Knowledge is knowing that a tomato and pepper are fruits. Wisdom is knowing whether to put these in a fruit salad

    Kindly

    [1] Use code tags. Place "[code]" before the first line of code and "[/code"]" after the last line of code. Exclude quotation marks
    [2] Mark your post [SOLVED] if it has been answered satisfactorily by editing your original post in advanced mode.
    [3] Thank (using the little scale) those that provided useful help; its nice and its very well appreciated

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Array to count how many days within a range are greater than 5

    =sumproduct(--(weekday(am6:aq6,2)<6),--(am6:aq6<>0))
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Valued Forum Contributor ron2k_1's Avatar
    Join Date
    09-30-2009
    Location
    Not the USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    606

    Re: Array to count how many days within a range are greater than 5

    Quote Originally Posted by martindwilson View Post
    =sumproduct(--(weekday(am6:aq6,2)<6),--(am6:aq6<>0))
    Yeah, I'm getting the #VALUE error with the above due to having some cells with "". I try do away with this, but not happening too.

    =sumproduct(--(weekday(am6:aq6,2)<6),--(am6:aq6<>0),--(am6:aq6<>""))

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Array to count how many days within a range are greater than 5

    Maybe this
    Please Login or Register  to view this content.
    Last edited by Marcol; 09-02-2011 at 08:13 PM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Array to count how many days within a range are greater than 5

    array entered
    =SUMPRODUCT(--(IF(ISERROR(WEEKDAY(AM6:AQ6,2)),8,WEEKDAY(AM6:AQ6,2))<6))
    Last edited by martindwilson; 09-02-2011 at 08:29 PM.

  6. #6
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Array to count how many days within a range are greater than 5

    Seems to work for me, what am I missing?

    Both will fail if there is a text entry in the range.

    [EDIT]
    Missed your last (edited) post Martin, that will handle text entries, but "" was the bogie, not " "
    .... Bear in mind that some of the cells in the range may be blank ...
    Attached Files Attached Files
    Last edited by Marcol; 09-02-2011 at 09:06 PM.

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Array to count how many days within a range are greater than 5

    hmmmmmmm im not so sure
    Attached Files Attached Files
    Last edited by martindwilson; 09-02-2011 at 08:53 PM.

  8. #8
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Array to count how many days within a range are greater than 5

    Hmmm?
    Please Login or Register  to view this content.
    As an array seems also to work if there is a text entry.
    Attached Files Attached Files
    Last edited by Marcol; 09-02-2011 at 09:04 PM. Reason: Added attachment

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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