+ Reply to Thread
Results 1 to 4 of 4

Count data in column x based on conditions in column y

  1. #1
    Registered User
    Join Date
    05-06-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Post Count data in column x based on conditions in column y

    Hi, I am wanting to count the number of records (excluding cells with no value) based on criteria in a corrosponding column.

    In column "AS" I have a number of records that are not sorted showing values "7", "13" and "2".

    In column "AL" there are values attached to some of these records based on certain IF statement conditions.

    I am wanting to count and sum the number of records in column "AL" that meet the conditions of "7" in column "AS" and so forth.

    Can anyone help me please?
    Last edited by creativefusion; 05-06-2009 at 03:07 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Count data in column x based on conditions in column y

    You can COUNT or you can SUM, up to you:

    COUNT:
    =SUMPRODUCT(--($AS$1:$AS$1000=7),--($AF$1:$AF$1000<>0))

    SUM:
    =SUMIF($AS$1:$AS$1000,"=7",$AF$1:$AF$1000)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Count data in column x based on conditions in column y

    A sample file would help I think, if you're saying AL contains Numerics and we assume AS also holds 7,13 etc as numbers then I think you're saying you want to use a SUMIF ?

    =SUMIF(AS:AS,7,AL:AL)

    To count see COUNTIF in XL Help, eg:

    =COUNTIF(AS:AS,7)

    Though the above obviously would count where AS = 7 regardless of whether AL had no value... without making use of a helper column (concatenating AL & AS into one string) you would need to use SUMPRODUCT preXL2007, eg:

    =SUMPRODUCT(--(AL1:AL1000<>""),--(AS1:AS1000=7))

    Note use of range 1:1000, pre XL2007 you can not use entire column references in Arrays/Sumproduct (ie AS:AS not viable) moreover you should avoid large ranges when using Arrays/Sumproducts as performance will be affected.

    If the above is not what you're after please post a sample file with Dummy data and expected results.

    EDIT: the above is essentially a re-iteration of JB's post.

  4. #4
    Registered User
    Join Date
    05-06-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Count data in column x based on conditions in column y

    Thanks heaps JB. It is exactly what I was after and the results show. Cheers...CF

+ 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