+ Reply to Thread
Results 1 to 3 of 3

Create macro to sort and count number of weekdays in year

  1. #1
    Registered User
    Join Date
    01-07-2015
    Location
    Saint Helens, OR
    MS-Off Ver
    2010
    Posts
    4

    Question Create macro to sort and count number of weekdays in year

    I am trying to create a macro that will sort and count the number of weekdays in a year, such as follows:
    Please Login or Register  to view this content.
    I want to be able to automatically count how many Mon., Tue., etc. in the year.
    Last edited by JBeaucaire; 01-07-2015 at 03:20 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Create macro to sort and count number of weekdays in year

    Assuming you had START and END dates for the range you wanted to "test" for Mondays in A1 and A2, this formula would give you a count of Mondays in that date range:

    =SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&A2)))=2))


    You should be able to adapt that to the dates you want and the days of the week needed in each cell you create a formula for in your table.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    01-07-2015
    Location
    Saint Helens, OR
    MS-Off Ver
    2010
    Posts
    4

    Re: Create macro to sort and count number of weekdays in year

    Thank you, I will definitely try that.

+ 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] want to count number of occurances on weekdays/weekends
    By phango13 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 01-14-2014, 08:07 PM
  2. [SOLVED] Count the number of duplicates in a range and then create a ranked sort
    By newbi004 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-20-2012, 01:16 PM
  3. [SOLVED] Help to Create a Macro that will sort by name and count non-numeric values
    By acamm9 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-21-2012, 01:22 PM
  4. How do i count number of weekdays between two dates?
    By Sanjay Shah in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-04-2005, 12:06 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