+ Reply to Thread
Results 1 to 5 of 5

Count if number matches critera

  1. #1
    Forum Contributor
    Join Date
    08-30-2007
    Location
    Vancouver, B.C.
    Posts
    149

    Count if number matches critera

    Column A contains a a number for each row

    Column B to G contains a list of qualifier for each row (different for every row)

    What is a good formula to count the total number of occurance where the number in column A for each row matches with one of the qualifier in column B to G of each row.

    For example:

    3 {1,2,3,4,5,6} COUNT
    10 {2,3,5,7,8,9} DO NOT COUNT
    22 {11,13,14,15,16,17} DO NOT COUNT
    56 {22,23,24,27,28,56} COUNT
    -----------------------------------
    Total 2

    Any ideas? Having a dummy column is not an option...=(
    Last edited by lazyme; 10-29-2007 at 04:34 PM.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    Does this work for you:

    Assuming your data is in rows 1-8,

    Use the array formula

    =SUM(--(A1:A8=B1:G8)) (Use Contrl Shift Enter to make it an array formula)

    ChemistB

  3. #3
    Forum Contributor
    Join Date
    08-30-2007
    Location
    Vancouver, B.C.
    Posts
    149
    Woo, nice. So simple too!

    By the way, what does the "--" do in formulas?

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    Try this user defined function taking your range of data of interest as its single arguement

    Please Login or Register  to view this content.
    Paste this into a new module in the VBA editor (alt F11)
    Martin

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Quote Originally Posted by lazyme
    ... what does the "--" do in formulas?
    It coerces False to 0 and True to 1 so that they can be used in arithmetic operations.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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