+ Reply to Thread
Results 1 to 5 of 5

Counting items within a range with column match criteria

  1. #1
    Registered User
    Join Date
    01-02-2020
    Location
    Australia
    MS-Off Ver
    MS Office 365
    Posts
    7

    Counting items within a range with column match criteria

    Greetings all,

    I've got a range of columns and rows (A1:I29). Column A contains dates in the month (28 days at a time) and columns B through I are used to record names of people rostered to work on those dates.

    In another sheet I have a named range (PublicHolidays) of known public holiday dates for the next few years.

    What I need to do, is return a single count of the number of people rostered on public holiday dates during the month. Essentially I need to check whether the date in A2 exists within the named range of public holiday dates, and if it does, count the number of items in the same row to the right of the date (i.e the number of people rostered on that day). I can do this for a single row using =IF(COUNTIF(PublicHolidays,Roster!A2),COUNTA(Roster!B2:I2),""), however I need a single total for all the rows in the range (A2:I29), not just a single row.

    Any ideas?

    I can't upload an example worksheet at the moment (work machine restrictions) but will do so later today if necessary.

    Many thanks in advance.

    Cheers

    Ben
    Last edited by benlw1984; 01-08-2020 at 07:54 PM.

  2. #2
    Registered User
    Join Date
    01-02-2020
    Location
    Australia
    MS-Off Ver
    MS Office 365
    Posts
    7

    Re: Counting items within a range with column match criteria

    Edit - example workbook attached now.

    Cheers

    Ben
    Attached Files Attached Files

  3. #3
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,548

    Re: Counting items within a range with column match criteria

    First of all let me say that I don't see anything wrong with using column K to get the total per row then using a formula like: =SUM(K2:K29)
    For aesthetic purposes column K could be moved and/or hidden.
    After all a spread sheet has 16384 columns, and the formulas are easy enough to understand that someone could modify them without too much trouble if requirements change.
    That said the following also works: =SUMPRODUCT(COUNTIFS(Tables!B4:F15,A2:A29)*(B2:I29<>""))
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  4. #4
    Registered User
    Join Date
    01-02-2020
    Location
    Australia
    MS-Off Ver
    MS Office 365
    Posts
    7

    Re: Counting items within a range with column match criteria

    Many thanks - that's exactly what I needed.

    Cheers

    Ben

  5. #5
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,548

    Re: Counting items within a range with column match criteria

    You're Welcome. Thank You for the feedback and for marking the thread as 'Solved'. I hope that you have a blessed day.

+ 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. Replies: 10
    Last Post: 01-02-2019, 04:14 PM
  2. Match Criteria in Range & Extract Column Header
    By sp0ck1 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-26-2018, 06:27 AM
  3. [SOLVED] Problem counting cells with text in a range if criteria in column have been met
    By SueBristow in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-23-2018, 05:35 AM
  4. [SOLVED] Need to count items in column that match multiple data items
    By bclucas55 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-27-2014, 10:03 AM
  5. Replies: 3
    Last Post: 02-07-2014, 03:01 AM
  6. [SOLVED] Two criteria, to match in 2 different Column range, but same row, same Order
    By david gonzalez in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-02-2013, 01:58 AM
  7. Counting items using criteria from 3 columns
    By gizzard in forum Excel General
    Replies: 5
    Last Post: 06-10-2011, 07:11 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