+ Reply to Thread
Results 1 to 11 of 11

How can I exclude counting ?#CALC!? when using the function COUNTIF()?

  1. #1
    Registered User
    Join Date
    05-09-2023
    Location
    New York, NY, USA
    MS-Off Ver
    Not sure
    Posts
    9

    How can I exclude counting ?#CALC!? when using the function COUNTIF()?

    Hi, I?m experiencing an issue with the function COUNTIF(). The value in cell D7 is supposed to be 0, but Excel counts ?#CALC!? as a valid value and instead returns 1. I wrote a formula to count the ?Pending? cases if a row in the column ?Anmed? is not blank. Is my approach incorrect to achieve what I?m trying to do?

    =COUNTIFS($A$10:$A$1014, "Pending", D$10:D$1014, "<>"&"", D$10:D$1014, "<>"&"#CALC!")

    Capture.PNG





    Thank you for your help!
    Attached Files Attached Files
    Last edited by zzxxclc; 06-30-2023 at 04:05 AM.

  2. #2
    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,844

    Re: How can I exclude counting ?#CALC!? when using the function COUNTIF()?

    There are instructions at the top of the page explaining how to attach your sample workbook (yellow banner: HOW TO ATTACH YOUR SAMPLE WORKBOOK). Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.

    Administrative Note:

    Is your forum profile showing the version of Excel that you need this to work for? "Not sure" is not acceptable.

    Members will tailor the solutions they offer to the version of Office (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your version is for Mac, please also state this.

    The three most recent versions of Excel are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the release number in your profile (e.g. MS365 Version 2211). This is in the About Excel section further down the Account page.

    Thanks.
    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.

  3. #3
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,427

    Re: How can I exclude counting ?#CALC!? when using the function COUNTIF()?

    =COUNTIF(A1:A3,"A") for example does not counting #CALC!. It counts only the A's.
    See attached workbook
    Attached Files Attached Files

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: How can I exclude counting ?#CALC!? when using the function COUNTIF()?

    1. Change the formula that PRODUCES the #CALC error to return a BLANK i.e. "" instead.


    2. Then try:
    =SUMPRODUCT(($A$10:$A$1014="Pending")*(D$10:D$1014<>""))
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Registered User
    Join Date
    05-09-2023
    Location
    New York, NY, USA
    MS-Off Ver
    Not sure
    Posts
    9

    Re: How can I exclude counting ?#CALC!? when using the function COUNTIF()?

    Thank you for your suggestion. I just attached the sample Excel file and my Excel version is Version2208!

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: How can I exclude counting ?#CALC!? when using the function COUNTIF()?

    As suggested change your FILTER formulae to remove the #CALC:

    =FILTER(OFFSET(Input!$A$1,1,XMATCH(D4,Input!1:1)-1,100,1),OFFSET(Input!$A$1,1,XMATCH(D4,Input!1:1),100,1)=$A$77,"")

    and use:

    =SUMPRODUCT(($A$5:$A$1009="Pending")*(D$5:D$1009<>""))

    I only changed ONE instance of the filter formula... you have to do the rest.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    05-09-2023
    Location
    New York, NY, USA
    MS-Off Ver
    Not sure
    Posts
    9

    Re: How can I exclude counting ?#CALC!? when using the function COUNTIF()?

    Hi Glenn,

    I appreciate your help! It worked for cell D7, but it returns "#CALC!" when the function is expanded to the next cell E7. I'm investigating what's going on with the function.

  8. #8
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,427

    Re: How can I exclude counting ?#CALC!? when using the function COUNTIF()?

    In your case I would use the #CALC! eliminate errors. Try in C77 and copy to the right:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    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,844

    Re: How can I exclude counting ?#CALC!? when using the function COUNTIF()?

    my Excel version is Version2208!
    Update your forum profile as instructed earlier. I presume this is Excel 365? Profile should read O365 v.2208.

  10. #10
    Registered User
    Join Date
    05-09-2023
    Location
    New York, NY, USA
    MS-Off Ver
    Not sure
    Posts
    9

    Re: How can I exclude counting ?#CALC!? when using the function COUNTIF()?

    Hi Hans, it resolved my issue! Thank you very much! Do you know why I had #CALC! error in my original function?

  11. #11
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,427

    Re: How can I exclude counting ?#CALC!? when using the function COUNTIF()?

    You had #CALC, because you didn't tell The FILTER-function what the function should return if nothing found (in the 3rd parameter of FILTER).

    Thanks for your feedback and glad to have helped.

+ 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. [SOLVED] Formula counting from 2 columns, countif function
    By MattExcelLearner in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 10-21-2019, 10:51 AM
  2. [SOLVED] Countif function not counting text
    By Liz23 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-12-2012, 01:12 AM
  3. COUNTIF function to exclude hidden cells
    By penfold1992 in forum Excel General
    Replies: 8
    Last Post: 08-15-2012, 02:01 PM
  4. [SOLVED] COUNTIF function not counting dates on 31st
    By mattmorris in forum Excel General
    Replies: 2
    Last Post: 07-03-2012, 10:37 AM
  5. countif function not counting :(
    By fsutaylor31 in forum Excel General
    Replies: 7
    Last Post: 01-06-2009, 04:39 PM
  6. Replies: 8
    Last Post: 12-12-2008, 07:12 PM
  7. Calc RSQ and exclude zeros
    By Bruce in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-19-2006, 09:10 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