+ Reply to Thread
Results 1 to 5 of 5

Countif - Only with specific cells in a column

Hybrid View

  1. #1
    Registered User
    Join Date
    12-31-2012
    Location
    Florida
    MS-Off Ver
    Excel 2016 - 365
    Posts
    54

    Countif - Only with specific cells in a column

    I am trying to count the times the word "Sunny" appears in a group of specific cells in column "D" and put the total in cell D177. There are 12 cells: D8, D22, D36, D50, D64, D78, D92, D106, D120, D148, D162. I have tried using Count and Countif, but they are designed for use with ranges.

    The problem I am facing is that the word "Sunny" can also appear in other cells in that column, which are not to be included in the total.

    Thanks again,
    Don

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,762

    Re: Countif - Only with specific cells in a column

    Try this. I would be happy to test it if you provide your file.

    Formula: copy to clipboard
    SUM(COUNTIF(INDIRECT({"D8,D22,D36,D50,D64,D78,D92,D106,D120,D148,D162"}),"Sunny"))


    ETA: Note that this formula is not movable because the range reference is text.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    12-31-2012
    Location
    Florida
    MS-Off Ver
    Excel 2016 - 365
    Posts
    54

    Re: Countif - Only with specific cells in a column

    Quote Originally Posted by 6StringJazzer View Post
    Try this. I would be happy to test it if you provide your file.

    Formula: copy to clipboard
    SUM(COUNTIF(INDIRECT({"D8,D22,D36,D50,D64,D78,D92,D106,D120,D148,D162"}),"Sunny"))


    ETA: Note that this formula is not movable because the range reference is text.

    Almost got it.


    Jeff,
    The formula does not work with more than one cell in it. When I remove all the cells, except for D8, it works fine. I tested by changing the contents from Sunny to Shade. If I add the next cell to be looked at D22, I get a #Ref! (Moving of deleting cells caused an invalid cell reference , or function is returning reference error).
    The total should be 3.

    Thanks
    Don
    Attached Files Attached Files
    Last edited by Mustang65; 06-09-2018 at 01:51 PM.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,762

    Re: Countif - Only with specific cells in a column

    I forgot that each continuous range must be separated. This is painful but works:

    =SUM(COUNTIF(INDIRECT({"D8","D22","D36","D50","D64","D78","D92","D106","D120","D134","D148","D162"}),"Sunny"))

  5. #5
    Registered User
    Join Date
    12-31-2012
    Location
    Florida
    MS-Off Ver
    Excel 2016 - 365
    Posts
    54

    Re: Countif - Only with specific cells in a column

    PERFECT!!!!!
    Thanks
    Don

+ 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 on a Specific Column Header versus a specific Column
    By usc1382 in forum Excel General
    Replies: 7
    Last Post: 07-14-2020, 02:41 AM
  2. Replies: 3
    Last Post: 01-07-2015, 03:55 AM
  3. countif on specific cells not a range.
    By pavlos in forum Excel General
    Replies: 2
    Last Post: 10-08-2012, 11:51 PM
  4. [SOLVED] Help please! Countif for specific cells in a row
    By RikkiBernaud in forum Excel General
    Replies: 11
    Last Post: 07-05-2012, 09:23 AM
  5. Using COUNTIF on specific cells
    By harshaputhraya in forum Excel General
    Replies: 4
    Last Post: 05-08-2006, 12:27 AM
  6. [SOLVED] countif >0, specific cells
    By Renee - California in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-07-2005, 07:05 PM
  7. Countif for specific cells rather than a range ????
    By Renee - California in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-27-2005, 03:05 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