+ Reply to Thread
Results 1 to 2 of 2

Using the COUNTIF with a wildcard but ONLY count visible rows

  1. #1
    Registered User
    Join Date
    11-08-2011
    Location
    Washington
    MS-Off Ver
    Excel 2003
    Posts
    24

    Using the COUNTIF with a wildcard but ONLY count visible rows

    Hello,

    I have a table of data and I am trying to return results using a wildcard. For example one column contains a few options (Stage 4 - MQL, Stage 2 - MPL, Stage 3 - MQL, etc). I'm using COUNTIF and wildcards to return a total of how many stage 2's I have, stage 3's, etc. The formula works great until I start filtering. It still counts the filtered rows and I would like to count just the visible rows. Is there an easy way to do this? My original formula that works great but returns visible and non visible results is =COUNTIF(H8:H1994, "*2*") This would give me a value of how many "Stage 2 - MPL" I had.

    I thought maybe something like this would work =SUBTOTAL(3, H8:H1994, "*2*") would work the same but only return back visible results but I can't get it to work any way I format it. I've tried using an AGGREGATE function too in a similar way.

    Any help would be great! Thanks!

    Evan

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

    Re: Using the COUNTIF with a wildcard but ONLY count visible rows

    Try something like this...

    =SUMPRODUCT(SUBTOTAL(3,OFFSET(H8,ROW(H8:H1994)-ROW(H8),0)),--ISNUMBER(FIND(2,H8:H1994)))

    That will count all cells that contain a 2.

    If there are others cells that contain a 2 that you do not want counted then maybe use the entire string as the criteria, like this:

    J1 = Stage 2 - MPL

    =SUMPRODUCT(SUBTOTAL(3,OFFSET(H8,ROW(H8:H1994)-ROW(H8),0)),--(H8:H1994=J1))
    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. Formula to count number of visible rows, and formula to count visible blanks
    By radoncadonc in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-28-2015, 04:19 PM
  2. Table Object after filtering - Count visible rows & First visible row
    By limalf in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-13-2013, 07:29 PM
  3. Countif with only visible rows
    By alwilly45 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-12-2011, 12:39 PM
  4. How to count visible rows only
    By JK1234 in forum Excel General
    Replies: 7
    Last Post: 03-02-2009, 03:37 PM
  5. Using COUNTIF with visible rows only
    By Dr Happy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-07-2005, 11:50 AM
  6. Replies: 1
    Last Post: 09-21-2005, 04:05 AM
  7. How to Count visible rows in Excel?
    By AJ Master in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-14-2005, 02:45 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