+ Reply to Thread
Results 1 to 5 of 5

Count dayname equal to

  1. #1
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Bryne, Norway
    MS-Off Ver
    Microsoft Office Excel 2010
    Posts
    230

    Count dayname equal to

    I have a range with dates and I want to count dayname equal to mon, tue, wed.....sun.

    I use a user defined function like the one below, but it is difficult to get this one to work together wiht COUNTIF.

    Any suggestion?

    Please Login or Register  to view this content.
    Last edited by mkvassh; 03-18-2010 at 09:47 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Count dayname equal to

    Not sure you really need a UDF here - it will generally perform slower than native functions...

    =SUMPRODUCT(--(WEEKDAY(range)=1))

    would give count of Sundays though assumes all values within range are valid dates, if not,

    =SUMPRODUCT(--(TEXT(range;"dddd")="Sunday")))

    amend per own local requirements

  3. #3
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: Count dayname equal to

    Hi,

    Would this work for you?

    =SUMPRODUCT((WEEKDAY(A1:A25)=daynumber)*1)

    where dayname is a number between 1 and 7 representing sunday to saturday.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  4. #4
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Bryne, Norway
    MS-Off Ver
    Microsoft Office Excel 2010
    Posts
    230

    Re: Count dayname equal to

    All of it works. Thank you :-)

  5. #5
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Bryne, Norway
    MS-Off Ver
    Microsoft Office Excel 2010
    Posts
    230

    Count daynames in a defined week

    -----------------------------------------------
    Last edited by mkvassh; 03-18-2010 at 09:47 AM.

+ 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