+ Reply to Thread
Results 1 to 5 of 5

Query with COUNTIFS across a range vs a column

  1. #1
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    846

    Query with COUNTIFS across a range vs a column

    Afternoon all,

    Quick query:

    spreadsheet to track agency staff expected throughout the week
    overview.PNG

    I tried to use COUNTIFS to count the amount of X's between B2:F14 where there was also the word 'red' in G2:G14.
    When I enter the formula as
    Please Login or Register  to view this content.
    it returns a #VALUE error, however if I enter the formula as
    Please Login or Register  to view this content.
    it returns the value I expect of 29.

    Why is this? Why can I not enter the formula using B2:F14?

    Regards

    Rich

  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,152

    Re: Query with COUNTIFS across a range vs a column

    The RANGES have to be same size in COUNTIFS : B14:G14 vs G2:G14 ( different) so your second formula works as all ranges are same size

    Try

    ="red = "&SUMPRODUCT(((B2:F14="X")*(G2:G14="red")))

  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Query with COUNTIFS across a range vs a column

    a good way to count across columns is to use sumproduct, maybe ="red = "&sumproduct(B2:B14*(b2:b14="X")*(B2:G14="red"))
    untested of course.

    Edited to add the red equals part.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  4. #4
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    846

    Re: Query with COUNTIFS across a range vs a column

    Thanks both, I've gone with the suggestion from John Topley but rep added for both, thanks for a quick response

  5. #5
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Query with COUNTIFS across a range vs a column

    thanks for the rep!

+ 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: 2
    Last Post: 04-03-2018, 08:47 PM
  2. [SOLVED] Replacement for this COUNTIFS formula using Power Query?
    By 4am in forum Excel General
    Replies: 0
    Last Post: 03-26-2018, 02:54 PM
  3. [SOLVED] Countifs query
    By thega in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-11-2017, 05:27 AM
  4. [SOLVED] Sum and Countifs Formula Shorter Query
    By ofd2008 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-26-2014, 10:18 AM
  5. [SOLVED] COUNTIFS within a date range but only if a second column meets a specified criteria
    By HeathWilD in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-29-2012, 01:14 AM
  6. Replies: 0
    Last Post: 12-16-2011, 09:01 AM
  7. Query a database from a range and output results in column next to range
    By gimiv in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-07-2007, 02:16 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