+ Reply to Thread
Results 1 to 6 of 6

Formula to count a number of different variables

  1. #1
    Registered User
    Join Date
    07-20-2012
    Location
    Derry
    MS-Off Ver
    Excel 2003
    Posts
    3

    Formula to count a number of different variables

    Hi

    I am looking to create a formula that will count a number of different variables.

    I need to count

    How many children live in a house under the age of 10.
    How many children over the age of 10, by ***.

    I was thinking a countif formula but not sure if this is right??

    Any help would be greatly appreciated.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Formula to count a number of different variables

    If you are counting based on multiple criteria, like age and s.e.x., and you have Excel 2003, then you need SUMPRODUCT.

    e.g.

    =SUMPRODUCT((A2:A100>=10)*(B2:B100="M"))

    where A2:B100 contains the data, and "M" means male... but you can replace with a cell reference containing the "M".

    For single criteria, COUNTIF should work

    e.g.

    =COUNTIF(A2:A100,"<10")
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    07-20-2012
    Location
    Derry
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Formula to count a number of different variables

    Thanks for this.

    Would this work with multiple people, i.e. child 1, child 2, etc?

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Formula to count a number of different variables

    It counts all male children over the age of 10.... is that what you mean?

  5. #5
    Registered User
    Join Date
    07-20-2012
    Location
    Derry
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Formula to count a number of different variables

    Basically what I have is raw data concerning people living within a house.

    I have a set of rules that need to be followed in order to calculate how many bedrooms are required in the house, i.e. 1 for mom & dad, 2 children under 10 no matter what *** can share, 2 children of same *** can share up to they are 16, different *** children can not share a room from the age of 10.

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Formula to count a number of different variables

    You can set up a table on the side, and do the counting, then sum up to get total rooms...etc...

    Can you post a sample workbook emulating your current database (no real names)? Showing some sample expected results.

+ 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