+ Reply to Thread
Results 1 to 15 of 15

Sum and Countif Combination Formula

  1. #1
    Forum Contributor
    Join Date
    08-23-2013
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 365
    Posts
    166

    Sum and Countif Combination Formula

    I am using a bunch of different criteria in a set of columns for a count. But it doesn't seem to be retrieving the right totals. Any advice or easier formula to do this?

    =SUM(COUNTIFS('Employee Data'!$G$19:$G$223,{"00"},'Employee Data'!$H$19:$H$223,{"6100","6525","6590"},'Employee Data'!$V$19:$V$223,{"FT"},'Employee Data'!$W$19:$W$223,{"active","inactive"}))

    Thanks!

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Sum and Countif Combination Formula

    1. you dont need to use {} for only 1 criteria ('Employee Data'!$G$19:$G$223,{"00"})
    2, if these are real numbers, then remove the ""
    {"6100","6525","6590"}
    3. if you still have a problem, upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    08-23-2013
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 365
    Posts
    166

    Re: Sum and Countif Combination Formula

    The numbers are in as text format.

    It is definitely something to with the {} combination criteria. Some are being excluded for some reason.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Sum and Countif Combination Formula

    can you upload a sample workbook?

  5. #5
    Forum Contributor
    Join Date
    08-23-2013
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 365
    Posts
    166

    Re: Sum and Countif Combination Formula

    The file is quite large, but I will take a piece to upload.
    I have found the problem is the formulas I use more than one criteria for a column: {"01","05","15"}, does this not function as an Or for each? It seems to exclude more columns than it should

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Sum and Countif Combination Formula

    I'll wait for the sample file, so we dont have to guess

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Sum and Countif Combination Formula

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.

  8. #8
    Forum Contributor
    Join Date
    08-23-2013
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 365
    Posts
    166

    Re: Sum and Countif Combination Formula

    So here I have 4 columns where I want to countifs multiple criteria in in each columns.
    Attached Files Attached Files

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Sum and Countif Combination Formula

    Thats interesting. I cannot see why it is not working, but the last part (active/inactive) seems to be the problem. If those are the only 2 ??active criteria you have, this seems to work...
    =SUM(COUNTIFS(C8:C22,{"01","05"},D8:D22,{"6100","6103"},E8:E22,"FT",F8:F22,"*active"))

    I have asked some other experts for their input, I am probably overlooking something here

  10. #10
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Sum and Countif Combination Formula

    Hi.

    To put it simply, you have "run out" of dimensions.

    See here for an explanation on the limitations to using COUNTIFS with multiple OR criteria:

    http://excelxor.com/2014/09/28/count...iteria_ranges/

    You would need to switch to SUMPRODUCT here:

    =SUMPRODUCT(0+ISNUMBER(MATCH(C8:C22,{"01","05"},0)),0+ISNUMBER(MATCH(D8:D22,{"6100","6103"},0)),0+ISNUMBER(MATCH(F8:F22,{"active","inactive"},0)),0+(E8:E22="ft"))

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  11. #11
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Sum and Countif Combination Formula

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    this works but suggest you move onto sumproduct like xor mentions if your going to have that many criteria
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Sum and Countif Combination Formula

    Thanks for the input, guys, I had a feeling it was something like that

  13. #13
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Sum and Countif Combination Formula

    @humdingaling

    That only works by pure coincidence in this particular case, but is logically flawed.

    For example, change some of the "6100" entries which occur next to a "01" to "6103". The result should still be 8, though your formula will not give that result.

    Perhaps you also need to read the post in the link I provided?

    Regards

  14. #14
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: Sum and Countif Combination Formula

    Quote Originally Posted by FDibbins View Post
    Thats interesting. I cannot see why it is not working, but the last part (active/inactive) seems to be the problem. If those are the only 2 ??active criteria you have, this seems to work...
    =SUM(COUNTIFS(C8:C22,{"01","05"},D8:D22,{"6100","6103"},E8:E22,"FT",F8:F22,"*active"))

    I have asked some other experts for their input, I am probably overlooking something here
    It does work but maybe not as expected

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Those in C column with 01 and in D with 6100 and in E with ft and in F with Active:

    Basically 01 - 6100 - FT - Active. Result: 4.
    PLUS
    those that match criteria 05 - 6013 - FT - Inactive Result: 1.

    4 + 1 = 5

  15. #15
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: Sum and Countif Combination Formula

    It took me almost an hour trying to figure out why it wasn't working and came here to find a link to it. Should've googled it instead. Hah!

    Something that's good to know anyways. Very interesting.

    Quote Originally Posted by XOR LX View Post
    See here for an explanation on the limitations to using COUNTIFS with multiple OR criteria:

    http://excelxor.com/2014/09/28/count...iteria_ranges/

+ 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. Countif Unique combination!!!
    By deadlyliquidxxx in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-01-2015, 03:08 PM
  2. Countif formula (I think) in combination with date range
    By adam141 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-24-2015, 03:16 PM
  3. Combination of CountIF, IF, and NOT
    By shani20 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-08-2011, 06:58 PM
  4. COUNTIF COMBINATION??
    By Heather in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-25-2005, 10:06 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