+ Reply to Thread
Results 1 to 7 of 7

Sumproduct with a range and CountIf criteria

  1. #1
    Registered User
    Join Date
    01-10-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    7

    Sumproduct with a range and CountIf criteria

    Hi I have not been able to find an answer elswhere so I figured I would post the question for some help.

    I have a sheet called outstanding that has column BO with numbers 1-100 in it, I have another column in that sheet B with Customers. I would like to first check to see if the customer matches and then if it falls within a certain range and if so count it.

    Example Sumproduct(Outstanding!BO:BO>=1)*(Outstanding!BO:BO<=20)If(Outstanding!B:B=D4)

    In the example above I would like to find anything that falls between 1 and 20 in column BO as long as it matches the customer name (D4) in column B:B.

    Any help could be greatly appreciated!

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Sumproduct with a range and CountIf criteria

    Try

    Sumproduct((Outstanding!BO:BO>=1)*(Outstanding!BO:BO<=20)*(Outstanding!B:B=D4))

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,705

    Re: Sumproduct with a range and CountIf criteria

    It's not a good idea to use full-column references with SUMPRODUCT - try COUNTIFS instead:

    =COUNTIFS(Outstanding!BO:BO,">=1",Outstanding!BO:BO,"<=20",Outstanding!B:B,D4)

    Hope this helps.

    Pete

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Sumproduct with a range and CountIf criteria

    =COUNTIFS(B1:B12,D4,BO1:BO12,">=1",BO1:BO12,"<=20")
    or
    =SUMPRODUCT(--(BO1:BO12>=1),--(BO1:BO12<=20),--(B1:B12=D4))
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  5. #5
    Registered User
    Join Date
    01-10-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Sumproduct with a range and CountIf criteria

    Thank you this worked perfectly! also thank you for the heads up on the full column reference, that may be why I have been having performance issues.

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,705

    Re: Sumproduct with a range and CountIf criteria

    Glad to help. COUNTIFS (and the other xxxIFx functions) is clever enough to only use the used range in its calculations, whereas SP and other array formulae will examine every cell in the range, used or not (and there are 1 million + in each column !!)

    Pete

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

    Re: Sumproduct with a range and CountIf criteria

    Quote Originally Posted by mhynson View Post

    I have a sheet called outstanding that has column BO with numbers 1-100 in it!
    If those are the only possibilities for column BO then:

    =COUNTIFS(Outstanding!BO:BO,"<=20",Outstanding!B:B,D4)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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] COUNTIF / SUMPRODUCT- multiple criteria - including date range
    By Sph01 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-31-2012, 04:54 AM
  2. Sumproduct or countif with multiple criteria
    By dralyagmas in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-30-2010, 02:01 AM
  3. Multiple criteria countif or sumproduct
    By jmerre in forum Excel General
    Replies: 9
    Last Post: 09-16-2009, 03:09 PM
  4. [SOLVED] countif/sumproduct on multiple criteria
    By Phil.M in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-01-2005, 02:06 AM
  5. [SOLVED] Using COUNTIF with 2 criteria - SUMPRODUCT?
    By Mike R. in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-24-2005, 02:06 AM

Tags for this Thread

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