+ Reply to Thread
Results 1 to 5 of 5

Countif function

  1. #1
    Registered User
    Join Date
    10-23-2008
    Location
    ohio
    Posts
    13

    Countif function

    Im trying to use the countif function to calculate totals. best way to try and explain is to go into this so here it is.

    A16:A55 is the qty's
    B16:B55 is the sizes

    Im trying to first get all the sizes listed in B16:B55, im not sure the function to get all the distinct values. Ive been just free handing it at the moment, which is dangerous since theres a chance i miss a size.

    Then I need to find out how many times they come up, which is why im trying to use the countif function.

    However what i dont know how to do is get it to consider the quantity in the A column.

    for example in A16 i have 6 and B16 I have 20x25x1
    A17 i have 8 and B17 I have 20x20x1
    A18 i have 4 and B18 I have 16x20x1
    A19 i have 2 and B19 I have 20x25x1

    Im trying to get a result of QTY Size
    8 20x25x1
    8 20x20x1
    4 16x20x1

    Hope this is enough info and of course there is going to be a lot more variable's and different sizes possible.

    Thanks
    Last edited by navigator25; 01-19-2011 at 12:04 PM.

  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: Countif function

    The function you want is SUMIF().

    =SUMIF(MatchRange, MatchValue, SumRange)


    =SUMIF(B:B, "20x25x1", A:A)
    =SUMIF(B:B, D3, A:A)
    Last edited by JBeaucaire; 01-19-2011 at 11:52 AM.
    _________________
    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
    Registered User
    Join Date
    10-23-2008
    Location
    ohio
    Posts
    13

    Re: Countif function

    Quote Originally Posted by JBeaucaire View Post
    The function you want is SUMIF().

    =SUMIF(MatchRange, MatchValue, SumRange)


    =SUMIF(B:B, "20x25x1", A:A)
    =SUMIF(B:B, D3, A:A)
    Thanks that will work great for adding all the qty's up. Is there a quick way to find out all the sizes without doing that by hand, so that i don't have a chance of missing one as i go through all of them?

  4. #4
    Registered User
    Join Date
    10-23-2008
    Location
    ohio
    Posts
    13

    Re: Countif function

    I ended up doing to the Advanced Filter Function to accomplish this, however is there any way I can skip rows that i dont want included into the function?

    Ive got it setup like this at the moment.

    Copy to another Location Selected
    List Range = $B$16:$B$110
    Criteria Range = $A$16:$A$110
    Copy To Range = $AF$16

    with the check box for unique records only.

    However when there is more than 1 sheet (anything after Row 55 on my sheet) There is a heading i would like it to skip over. In other words I would like to to add up my list range as follows B16:B55 & B71:B110 not B56:B70. Every time i try something in there it doesn't allow me to do that. As well as do the same thing with the Criteria Ranges.

    Any Thoughts?

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

    Re: Countif function

    ADV filter will skip one title range. I'm sure you can run your ADV filter, sort the resulting list and delete the duplicate headers without much problem.

+ 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