+ Reply to Thread
Results 1 to 7 of 7

Countif Dynamic Range

  1. #1
    Registered User
    Join Date
    06-12-2014
    Posts
    19

    Countif Dynamic Range

    Hello,

    I have a large file with multiple embedded formulas that auto-update based on what Month / Year I input into A2 & B2. I then concatenate this Month and Year along with a static reference number to identify data on other sheets I need to reference - it ends up looking like 320161, 420161, etc.

    In the example attached I need to write a formula in cell E4 that will count all of the values under the corresponding reference column on Sheet2. So for the given example I'm trying to get it to return 7.

    I've tried using multiple different combinations of the Countif, Match, Address, Indirect, and offset functions but with no success. Can someone please help get me on the right track for how I would do this.

    Please also note, this is just an example of what I'm trying to do on a much larger, confidential file.

    Thank you!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,148

    Re: Countif Dynamic Range

    Try

    =SUMPRODUCT((Sheet2!$B$3:$E$10="X")*(Sheet2!$B$2:$E$2=Sheet1!$E$2))

  3. #3
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,937

    Re: Countif Dynamic Range

    =COUNTIF(INDEX(Sheet2!$1:$10,,MATCH(Sheet1!$E$2,Sheet2!2:2,FALSE)),"X")
    Bernie Deitrick
    Excel MVP 2000-2010

  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: Countif Dynamic Range

    Maybe this...

    =COUNTA(INDEX(Sheet2!B3:E10,0,MATCH(E2,Sheet2!B2:E2,0)))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    06-12-2014
    Posts
    19

    Re: Countif Dynamic Range

    Thank you so much! Both the COUNTIF and COUNTA functions worked. I was, unfortunately, unable to get the SUMPRODUCT solution to work.

    Many thanks!

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

    Re: Countif Dynamic Range

    You're welcome. We appreciate the feedback!

  7. #7
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,937

    Re: Countif Dynamic Range

    Great - glad to hear you were able to apply the formula.

    For the SUMPRODUCT formula, you need to make sure that you have the same number of columns in each reference - for your example, that was B:E - and only one row in the second sheet2 reference

    =SUMPRODUCT((Sheet2!$B$3:$E$10="X")*(Sheet2!$B$2:$E$2=Sheet1!$E$2))

+ 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 with offest and countif (Dynamic range)
    By LEEDA12345 in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 02-21-2014, 10:13 AM
  2. Using COUNTIF with a dynamic range
    By ruthjames in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-25-2013, 11:20 AM
  3. [SOLVED] COUNTIF Function with Dynamic Range
    By rzrbkpk in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-02-2013, 04:07 AM
  4. COUNTIF: dynamic range
    By BATISTAJM in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-22-2013, 07:17 PM
  5. Offset and Countif with dynamic Range
    By JKK123 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-22-2013, 12:15 AM
  6. Dynamic Range using Offset and CountIF
    By mark_jam3s in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-04-2008, 11:43 AM
  7. Offset, Dynamic range, Countif
    By Bryce in forum Excel General
    Replies: 3
    Last Post: 10-26-2005, 08:05 AM

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