+ Reply to Thread
Results 1 to 4 of 4

combine SUMPRODUCT & COUNTIFS

  1. #1
    Registered User
    Join Date
    10-25-2016
    Location
    Brussels
    MS-Off Ver
    2010
    Posts
    17

    combine SUMPRODUCT & COUNTIFS

    Hi Experts

    I have following problem/issue:
    I want a formula to count (to return) the number of occurrences of a (sub)string in a filtered column
    where the count takes into account only the visible cells in the selection

    I think I might need a combination of 2 formula's (SUMPRODUCT & COUNTIFS)
    1. =SUMPRODUCT(SUBTOTAL(3;OFFSET(G4:G99999;ROW(G4:G99999)-ROW(G4);0;1));--(G4:G99999="ART"))
    2. =COUNTIFS(G4:G99999;"*OR*")

    Formula 1. does the job, but can only be used for complete strings, not parts of strings
    Formula 2. counts the correct occurrences of a (sub)string, but counts the whole range of the column, not just the visible cells of the filtered column

    Example:
    COLUMN A is filled with data an has an AutoFilter on it in Cell G3
    I want the formula to give it's result in cell A1
    Formula 1.
    =SUMPRODUCT(SUBTOTAL(3;OFFSET(G4:G99999;ROW(G4:G99999)-ROW(G4);0;1));--(G4:G99999="ART"))
    does the job, but can only be used for complete occurrences of the search strings, not parts...

    Formula 2. =COUNTIFS(G4:G99999;"*OR*")
    counts the correct occurrences of a (sub)string, but counts the whole range of the column, not just the visible cells of the filtered column

    I definitely need help on this one.
    Anyone can help me out on this?
    Thx in advance for sharing your wisdom ;-)

    Greets
    A
    Attached Images Attached Images

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: combine SUMPRODUCT & COUNTIFS

    Maybe try

    =SUMPRODUCT(SUBTOTAL(3;OFFSET(G4:G99999;ROW(G4:G99999)-ROW(G4);0;1));--isnumber(search("or";G4:G99999)))

    Change "or" to any part or word.

  3. #3
    Registered User
    Join Date
    10-25-2016
    Location
    Brussels
    MS-Off Ver
    2010
    Posts
    17

    Re: combine SUMPRODUCT & COUNTIFS

    Thank you very much; that did the trick!!!

    To make things easier i refer to cell H1 where I enter the search string; so that gives:
    =SUMPRODUCT(SUBTOTAL(3;OFFSET(H4:H99999;ROW(H4:H99999)-ROW(H4);0;1));--ISNUMBER(SEARCH(CONCATENATE("*";H1;"*");H4:H99999)))

    Once again, Thx!
    [Issue Solved]

  4. #4
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: combine SUMPRODUCT & COUNTIFS

    FYI

    No need wildcard for search, just H1 is enough.

    =SUMPRODUCT(SUBTOTAL(3;OFFSET(H4:H99999;ROW(H4:H99999)-ROW(H4);0;1));--ISNUMBER(SEARCH(H1;H4:H99999)))

+ 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. Combine sumif/sumproduct or sumproduct with multiple criteria
    By sab128 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-16-2018, 08:25 AM
  2. [SOLVED] Sumproduct to replace countifs as countifs don't work on external source reference
    By KrishnaSagar in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-02-2017, 02:33 AM
  3. Combine SUM(COUNTIFS) and divide
    By UFriede in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-29-2016, 01:05 PM
  4. Unable to combine FREQUENCY with COUNTIFS
    By Semper.Fi.Rob in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-22-2015, 08:16 AM
  5. [SOLVED] combine countifs?
    By kiki burgh in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-10-2014, 11:13 PM
  6. [SOLVED] Is there a way to combine COUNTIFS and SUMPRODUCT?
    By ogbugsy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-21-2013, 08:18 AM
  7. Need to combine several countifs for the same ranges
    By kbb222 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-10-2013, 06:45 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