+ Reply to Thread
Results 1 to 4 of 4

Need help combining advanced countif functions....

  1. #1
    Registered User
    Join Date
    08-30-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Need help combining advanced countif functions....

    Hello,
    I am working with data analysis and I'm creating a spreadsheet. I've hit a hurdle that I need some help with. I have two functions that I want to nest together but I cannot figure it out. If it were simple I would use the countifs function but because the first function is a range I'm having trouble. Here's what I have and what I want to do:

    1. Cell 1 has the result of the following function: =COUNTIF(Raw!E:E,">="&0)-COUNTIF(Raw!E:E,">"&19) ...this counts the number of cells in the raw data worksheet that has a person between the ages of 0 and 19. This works great... the answer is 1 (out of 4860 people).

    2. Cell 2 has the result of the following function: =COUNTIF(Raw!I:I, "white") ...this counts the number of cells in the raw data worksheet that has a person classified as white. Again, works great... the answer is 4037 (again out of 4860).

    In Cell 3 I want it to return the number of white people who are between the ages of 0-19 by combining the above functions. The answer to the above example should be 1 because there is only 1 person in this group of data who is between the ages of 0-19 and happens to be white. When I run the same function in cell 4 later for blacks, the answer should be 0. This will of course get more complicated when I try to find the number of whites who are between the ages of 60-79 because there are 2957 people in that age group. Can someone tell me how to do this? I've tried a number of things and they all return errors. I tried to add the functions together but that just gives me the sum of the them which is not what I'm looking for. I tried to nest them together but I'm doing it wrong. I'd greatly appreciate the help. Thanks!!

  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: Need help combining advanced countif functions....

    =COUNTIF(Raw!E:E,">="&0)-COUNTIF(Raw!E:E,">"&19)
    A question...

    People are typically NOT classified as being 0 yrs old. Can't you just use:

    =COUNTIF(Raw!E:E,"<=19")

    Once we get that straightened out you can do this with a COUNTIFS function.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    08-30-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Need help combining advanced countif functions....

    Hey, thanks for the reply!! Sure, I get it... but when I do the next string of people between 20-39 I will run into the same problem.

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

    Re: Need help combining advanced countif functions....

    Try something like this...


    Data Range
    E
    F
    G
    H
    I
    J
    K
    1
    Age
    Color
    From
    To
    Green
    Brown
    2
    37
    Black
    0
    19
    1
    0
    3
    64
    Black
    20
    39
    2
    1
    4
    26
    blue
    40
    59
    1
    2
    5
    35
    Blue
    6
    48
    Blue
    7
    64
    Blue
    8
    26
    Brown
    9
    51
    Brown
    10
    59
    Brown
    11
    18
    Green
    12
    24
    Green
    13
    26
    Green
    14
    51
    Green
    15
    18
    Red
    16
    29
    Red
    17
    3
    White
    18
    28
    White
    19
    51
    White
    20
    16
    Yellow


    This formula entered in J2:

    =COUNTIFS($E$2:$E$20,">="&$H2,$E$2:$E$20,"<="&$I2,$F$2:$F$20,J$1)

    Copy across to K2 then down as needed.

+ 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. Combining Functions Countif & Frequency
    By vagabond in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-10-2010, 08:04 AM
  2. Combining IF and COUNTIF functions
    By cbee907 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-26-2010, 11:35 AM
  3. [SOLVED] Combining LOOKUP and COUNTIF functions
    By kate_suzanne in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-22-2006, 02:05 AM
  4. [SOLVED] Combining COUNTIF and AND functions
    By david in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 07-06-2006, 10:00 PM
  5. combining countif and mid or right functions
    By Charles Woll in forum Excel General
    Replies: 5
    Last Post: 07-09-2005, 08:05 PM

Tags for this Thread

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