+ Reply to Thread
Results 1 to 5 of 5

Counting non-zero cells across multiple columns with changing criteria

  1. #1
    Registered User
    Join Date
    12-04-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    79

    Counting non-zero cells across multiple columns with changing criteria

    Hi,

    Struggling to get my head around a COUNTIF >0 when spread across multiple columns and the columns to count can change from a drop down menu, whilst ensuring that I don't double count rows where they have data within multiple columns.

    Hopefully this makes sense in the example below:

    Column
    A B C
    0 1 0
    1 0 1
    0 0 2
    0 0 0

    Cell A1 is a drop down list: A, B, C, AB, AC, BC

    In cell B1 I am looking for a formula that will tell me, based on cell A1, how many of the rows are not zero.

    For example if A1 = BC
    Then the result in B1 would be = 3 (3 of the rows have a number that is not zero in columns B or C.

    If A1 = B then B1 = 1 because only one row has a number that is not zero in column B

    If A1 = AC the B1 = 2 because only two rows have a number that is not zero in columns A or C. Note that row 2 is only counted once despite having a number in columns A AND C.

    I am prepared that I may need some helper cells to make this possible.

    Thanks for helping me with this brain teaser!!!

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2506
    Posts
    13,791

    Re: Counting non-zero cells across multiple columns with changing criteria

    Hi RoundaboutCJP.

    With data as described array enter this formula in B1. If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.
    Formula: copy to clipboard
    Please Login or Register  to view this content.




    A
    B
    C
    D
    E
    F
    1
    BC
    3
    A
    B
    C
    2
    0
    1
    0
    3
    1
    0
    1
    4
    0
    0
    2
    5
    0
    0
    0
    Dave

  3. #3
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2506
    Posts
    13,791

    Re: Counting non-zero cells across multiple columns with changing criteria

    Here is another way to do it. This formula does not have to be array entered.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Workbook is attached with both formulas.

  4. #4
    Registered User
    Join Date
    12-04-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    79

    Re: Counting non-zero cells across multiple columns with changing criteria

    Thanks so much. No way I could have discovered that solution without your help. I went with the array formula that works a treat.

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2506
    Posts
    13,791

    Re: Counting non-zero cells across multiple columns with changing criteria

    You're welcome. Glad to hear it does the job. Thanks for the feedback, added rep and marking your thread Solved.

+ 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] Counting cells that meet multiple single criteria as variable criteria
    By BillBasil in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-01-2016, 10:33 AM
  2. Counting cells - changing criteria
    By Xcelfan in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 01-04-2015, 02:23 PM
  3. [SOLVED] counting cells/rows across multiple criteria (columns)
    By vf_guy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-19-2014, 10:06 PM
  4. Counting data with multiple criteria from different columns
    By Muammar in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 09-10-2012, 08:24 AM
  5. Replies: 3
    Last Post: 03-01-2012, 06:17 AM
  6. Counting Cells with multiple criteria.One criteria supporting wild
    By Azhar Saleem in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-12-2005, 07:06 AM
  7. Counting Cells with multiple criteria.One criteria supporting wild
    By Azhar Arain in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-12-2005, 05:06 AM

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