+ Reply to Thread
Results 1 to 10 of 10

Countifs function

  1. #1
    Registered User
    Join Date
    05-27-2016
    Location
    LA
    MS-Off Ver
    14.0.7147.5001 (64-bit)
    Posts
    18

    Countifs function

    Hi,

    I need some help with my Countifs function. This is the formula I have so far.

    =ROUND(SUMPRODUCT(COUNTIFS(INDIRECT(""&$A$20:$A$23&"!$F:$F"),"=0",INDIRECT(""&$A$20:$A$23&"!$G:$G"),"=0",INDIRECT(""&$A$20:$A$23&"!$H:$H"),"=0",INDIRECT(""&$A$20:$A$23&"!$B:$B"),">="&$D$6,INDIRECT(""&$A$20:$A$23&"!$B:$B"),"<"&$E$6))/SUMPRODUCT(COUNTIFS(INDIRECT(""&$A$20:$A$23&"!$F:$F"),"<>",INDIRECT(""&$A$20:$A$23&"!$G:$G"),"<>",INDIRECT(""&$A$20:$A$23&"!$H:$H"),"<>",INDIRECT(""&$A$20:$A$23&"!$B:$B"),">="&$D$6,INDIRECT(""&$A$20:$A$23&"!$B:$B"),"<"&$E$6)),2)*100

    WHAT I NEED HELP WITH: I want to count how many times the value 0 appears in the columns F, G, and H, TOTAL. Right now the formula is counting how many times 0 appears as a value in each row in ALL three columns. It only counts if 0 appears in F,G,and H, in a particular row. So I want it to count it if there is a 0 in, for example, Row 1 and Column F, even if there is a 1 or 2 in Row 1, Columns G/H.

    I know that a + is supposed to kind of act as an "or" in this case, but no matter what I type, it doesn't seem to work. Can anyone help?

    Thank you so much!
    Attached Files Attached Files
    Last edited by Vera1234; 05-27-2016 at 02:53 PM.

  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,938

    Re: Countifs function

    Hi, welcome to the forum \

    That us a very complex looking formula there, and it will be hard to break it apart and test, withouit seeing a sample of what you are using it on, so can you upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like?
    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.
    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 Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Countifs function

    For COUNTIFS you will need (as an example)

    =COUNTIFS(F1:F30,0)+COUNTIFS(G1:G30,0)+COUNTIFS(H1:H30,0) OR condition

    this will not work

    =COUNTIFS(F1:F30,0,G1:G30,0,H1:H30,0) AND condition which is what you have in your formula.

  4. #4
    Registered User
    Join Date
    05-27-2016
    Location
    LA
    MS-Off Ver
    14.0.7147.5001 (64-bit)
    Posts
    18

    Re: Countifs function

    Hi, thanks for replying! I attached a sample workbook to my initial post just now, is that what you are looking for? the formula is located in B10 of the sheet named REPORT_GR (draft). Sheets F1-F4 are where I am drawing the data from.

  5. #5
    Registered User
    Join Date
    05-27-2016
    Location
    LA
    MS-Off Ver
    14.0.7147.5001 (64-bit)
    Posts
    18

    Re: Countifs function

    Hi John, thanks for your reply. Yes, I tried to use the OR condition, but for some reason, it is not working out. I might be getting things wrong because they are indirect formulas.

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Countifs function

    This works ...

    =SUMPRODUCT(COUNTIFS(INDIRECT("'"&$A$20:$A$21&"'!$F:$F"),0,INDIRECT("'"&$A$20:$A$21&"'!$B:$B"),">="&$D$6,INDIRECT("'"&$A$20:$A$21&"'!$B:$B"),"<"&$E$6)+COUNTIFS(INDIRECT("'"&$A$20:$A$21&"'!$G:$G"),0,INDIRECT("'"&$A$20:$A$21&"'!$B:$B"),">="&$D$6,INDIRECT("'"&$A$20:$A$21&"'!$B:$B"),"<"&$E$6)+COUNTIFS(INDIRECT("'"&$A$20:$A$21&"'!$H:$H"),0,INDIRECT("'"&$A$20:$A$21&"'!$B:$B"),">="&$D$6,INDIRECT("'"&$A$20:$A$21&"'!$B:$B"),"<"&$E$6))

  7. #7
    Registered User
    Join Date
    05-27-2016
    Location
    LA
    MS-Off Ver
    14.0.7147.5001 (64-bit)
    Posts
    18

    Re: Countifs function

    John, thank you so much!! I really appreciate your help. It is working great One last thing, for anyone willing to help, the values in my chart are showing up as numbers right now, is there a way to convert them to percentages? So, each column in the chart (1 through 7) adds up to 18 values, but I want them to add up to 100% instead. For example, Column 1 in my chart (Column B) has 7 instances of "No Improvement" out of 18, but I want it to say "39%" instead, and so forth. I'm attaching a new workbook sample with the chart fixed with John's formula.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Countifs function

    Try this ....

    =sumproduct(countifs(indirect("'"&$a$20:$a$21&"'!$f:$f"),0,indirect("'"&$a$20:$a$21&"'!$b:$b"),">="&$d$6,indirect("'"&$a$20:$a$21&"'!$b:$b"),"<"&$e$6)+countifs(indirect("'"&$a$20:$a$21&"'!$g:$g"),0,indirect("'"&$a$20:$a$21&"'!$b:$b"),">="&$d$6,indirect("'"&$a$20:$a$21&"'!$b:$b"),"<"&$e$6)+countifs(indirect("'"&$a$20:$a$21&"'!$h:$h"),0,indirect("'"&$a$20:$a$21&"'!$b:$b"),">="&$d$6,indirect("'"&$a$20:$a$21&"'!$b:$b"),"<"&$e$6))/sumproduct(countifs(indirect("'"&$a$20:$a$21&"'!$f:$f"),">=0",indirect("'"&$a$20:$a$21&"'!$b:$b"),">="&$d$6,indirect("'"&$a$20:$a$21&"'!$b:$b"),"<"&$e$6)+countifs(indirect("'"&$a$20:$a$21&"'!$g:$g"),">=0",indirect("'"&$a$20:$a$21&"'!$b:$b"),">="&$d$6,indirect("'"&$a$20:$a$21&"'!$b:$b"),"<"&$e$6)+countifs(indirect("'"&$a$20:$a$21&"'!$h:$h"),">=0",indirect("'"&$a$20:$a$21&"'!$b:$b"),">="&$d$6,indirect("'"&$a$20:$a$21&"'!$b:$b"),"<"&$e$6))


    (You could replace the ">=0" with "<>")
    Attached Files Attached Files
    Last edited by JohnTopley; 05-28-2016 at 02:43 AM.

  9. #9
    Registered User
    Join Date
    05-27-2016
    Location
    LA
    MS-Off Ver
    14.0.7147.5001 (64-bit)
    Posts
    18

    Re: Countifs function

    Thank you so much, John!!! Everything is working perfectly now. Thanks for your time and effort.

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Countifs function

    If all is OK, could you please mark thread as solved ("Thread Tools" at top of first post).

    Appreciate the feedback.

+ 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. Countifs + OR function
    By Espenjk in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-11-2016, 07:52 PM
  2. COUNTIFS Function - HELP
    By RandomPezzer in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-19-2016, 08:48 PM
  3. COUNTIF/COUNTIFS function + nested user-defined function
    By shamjamali in forum Excel General
    Replies: 1
    Last Post: 05-12-2015, 09:12 PM
  4. Use COUNTIFS function on results of DATEVALUE function?
    By Si902 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-16-2015, 08:13 PM
  5. [SOLVED] COUNTIFS function...
    By ericarodgers in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-10-2013, 01:34 AM
  6. Replies: 0
    Last Post: 12-16-2011, 09:01 AM
  7. Must use COUNTIFS function......
    By Paarlite2 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-13-2008, 12:18 AM

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