+ Reply to Thread
Results 1 to 16 of 16

CountIf Not Working with TRUE Criterion

  1. #1
    Registered User
    Join Date
    07-13-2021
    Location
    US
    MS-Off Ver
    Microsoft Office and Business 2016
    Posts
    10

    CountIf Not Working with TRUE Criterion

    Hello. I'm creating a schedule and have an IF/AND formula working perfectly for the days the employees will work:

    example: =IF((AND(Sunday!BO4=TRUE,'Days of the Week'!C4=TRUE)),"B",IF((AND(Sunday!BP4=TRUE,'Days of the Week'!C4=TRUE)),"B",IF((AND(Sunday!BO4=FALSE,'Days of the Week'!C4=TRUE)),"TRUE",IF((AND(Sunday!BP4=FALSE,'Days of the Week'!C4=TRUE)),"TRUE","FALSE"))))

    Conditional formatting is set to fill with color depending on the result. This all works.

    My problem is in trying to COUNTIF the cell has TRUE. It's not counting and I'm not sure why. I need other formulas to recognize the results of the IF/AND formula. Any idea what the problem may be?

    CountIf formula: =IFERROR(SUMPRODUCT(COUNTIF(B4:B18, TRUE)),0)


    Thank you for any and all assistance!
    Last edited by AliGW; 07-14-2021 at 12:57 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    901

    Re: CountIf Function for Formula Results

    Wouldnt you want to place your IF formula in as your "TRUE" parameter for the IFERROR?
    If you find the suggestion or solution helpful, please consider adding reputation to the post.

  3. #3
    Registered User
    Join Date
    07-13-2021
    Location
    US
    MS-Off Ver
    Microsoft Office and Business 2016
    Posts
    10

    Re: CountIf Function for Formula Results

    Thank you for your response.

    Wouldn't that count all formulas, though? I'd only want TRUE results counted.

  4. #4
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    901

    Re: CountIf Function for Formula Results

    if im reading that formula correctly, its only returning TRUE if those conditions are met correct?
    And FALSE if not..

    You can try it on one or two and see..

    So the end formula would look like this:

    =IFERROR(SUMPRODUCT(COUNTIF(B4:B18, IF((AND(Sunday!BO4=TRUE,'Days of the Week'!C4=TRUE)),"B",IF((AND(Sunday!BP4=TRUE,'Days of the Week'!C4=TRUE)),"B",IF((AND(Sunday!BO4=FALSE,'Days of the Week'!C4=TRUE)),"TRUE",IF((AND(Sunday!BP4=FALSE,'Days of the Week'!C4=TRUE)),"TRUE","FALSE")))))),0)

    Without a sample file to work with, im just guessing if that structure is correct.

    If thats not returning the correct results or any at all, it may need to be a mix of another function to get what you need.

  5. #5
    Registered User
    Join Date
    07-13-2021
    Location
    US
    MS-Off Ver
    Microsoft Office and Business 2016
    Posts
    10

    Re: CountIf Function for Formula Results

    There are three possible results: B, TRUE, FALSE. I only want TRUE to be counted.

    Please find the sample attached. For context, the Shift, Lunch, and Break times are supposed to be highlighted on the corresponding day tabs (i.e. if on the Agent Work Week tab, the cell for Monday is green and times are entered, then the Monday tab should have the corresponding time cells also filled with green.) This is why I need the formula results to be recognized by other formulas.
    Attached Files Attached Files
    Last edited by KCG98; 07-13-2021 at 03:42 PM.

  6. #6
    Registered User
    Join Date
    07-13-2021
    Location
    US
    MS-Off Ver
    Microsoft Office and Business 2016
    Posts
    10

    Re: CountIf Function for Formula Results

    Oh! Also, for B19 on Agent work weeks tab, I did try the formula you suggested and it doesn't work.

  7. #7
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    901

    Re: CountIf Function for Formula Results

    Would you be able to update the sample file with some test data so its a little easier to test why things are not working?

  8. #8
    Registered User
    Join Date
    07-13-2021
    Location
    US
    MS-Off Ver
    Microsoft Office and Business 2016
    Posts
    10

    Re: CountIf Function for Formula Results

    Absolutely! I appreciate your time.

  9. #9
    Registered User
    Join Date
    07-13-2021
    Location
    US
    MS-Off Ver
    Microsoft Office and Business 2016
    Posts
    10

    Re: CountIf Function for Formula Results

    Alright, so here are two samples with the information filled out. The difference between the two are as follows:

    Rush Detailed CS Schedule Sample - Formulas have been added to Agent work weeks tab to reflect days requested off

    Functional Detailed CS Schedule Sample - This is the original schedule I was working with, and everything is functional. The check boxes in the Days of the Week tab are directly linked to the cells in the Agent work weeks tab, so the COUNTIF formulas from B16 through H16 works.

    Please let me know if you have any further questions.

  10. #10
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    901

    Re: CountIf Function for Formula Results

    Found the problem and it wasnt really obvious right away..
    You have a mix of "TRUE" and TRUE within the formulas

    In your Rush file, in cell B19 place this formula:
    Please Login or Register  to view this content.
    Then in B18 enter this formula and copy up to B4
    Please Login or Register  to view this content.
    The number of agents will change from 0 to the number in your sheet, at least it changed on my copy. But not sure its right.. my copy went from 0 to 11 once i updated all "TRUE" and "FALSE" to TRUE and FALSE(Remove the quotes)

    See if that gets you what you need or if it still needs adjustments.

  11. #11
    Registered User
    Join Date
    07-13-2021
    Location
    US
    MS-Off Ver
    Microsoft Office and Business 2016
    Posts
    10

    Re: CountIf Function for Formula Results

    Hey. It's close! The FALSE are being counted, not the TRUE cells. I only updated Column B.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    07-13-2021
    Location
    US
    MS-Off Ver
    Microsoft Office and Business 2016
    Posts
    10

    Re: CountIf Function for Formula Results

    Something strange happens when I select the Sunday checkbox for C4 on the Days of the week tab. It starts counting the TRUE cells.

    Attachment 740335

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: CountIf Not Working with TRUE Criterion

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however the thread title does not really convey what your request is about. Tell us what you are trying to do, not how you think it should be done.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. As you are new I have done it for you today.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  14. #14
    Registered User
    Join Date
    07-13-2021
    Location
    US
    MS-Off Ver
    Microsoft Office and Business 2016
    Posts
    10

    Re: CountIf Not Working with TRUE Criterion

    Thank you, Ali.

    cubangt, please hold for a moment. I'm playing around with the formulas, and it looks like the original COUNTIF is working now, so the changes to the IF/AND may have done the job. I'm currently adjusting a few other things and will update once I confirm this is good. I greatly appreciate your help and patience!

  15. #15
    Registered User
    Join Date
    07-13-2021
    Location
    US
    MS-Off Ver
    Microsoft Office and Business 2016
    Posts
    10

    Re: CountIf Not Working with TRUE Criterion

    cubangt, this is perfect! Your help was invaluable and much appreciated!

  16. #16
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    901

    Re: CountIf Not Working with TRUE Criterion

    Awesome, if you felt it help, consider clicking the add reputation on the post that helped.

    Glad its working for you now.

+ 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. Adding a COUNTIF function to an existing IF AND COUNTIF Formula...
    By Ourkid123uk in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-24-2018, 10:09 AM
  2. [SOLVED] Countif Function and place results in one cell.
    By thedunna in forum Excel General
    Replies: 3
    Last Post: 01-06-2017, 03:50 PM
  3. [SOLVED] Use COUNTIF function get results one after another by dragging.
    By avijit74 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-27-2016, 11:13 AM
  4. [SOLVED] Getting wrong results for frequency function and countif functions
    By KurtBliss in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-13-2015, 06:39 PM
  5. How do you use the results of one formula in a CountIf?
    By JoeT77 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-24-2013, 10:32 AM
  6. [SOLVED] countif column results of If/Match formula
    By Lmgtfy in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-02-2013, 12:04 AM
  7. CountIf NetWorkDays Formula Results
    By ClikClak in forum Excel General
    Replies: 6
    Last Post: 03-03-2010, 05:01 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