+ Reply to Thread
Results 1 to 5 of 5

Countifs but exclude a particular reference

  1. #1
    Registered User
    Join Date
    12-15-2022
    Location
    Seattle, WA
    MS-Off Ver
    8
    Posts
    2

    Countifs but exclude a particular reference

    I'm going to apologize right off the bat. I've never used VBA before but I have used the countifs formula so I'm not sure if I'm going about this the right way. I have an array that I want to count if the cell reference equals a specific name. However, if the name referenced has a strikethrough it, how do I exclude that in the count? I've found other wonderful experts who have shared countstrike or countnostrike codes, but that counts everything with a strike or no strike. My issue is I want to count a specific name in my array without the strike.

    I hope that makes sense and if anyone has any insight, I'd appreciate the help. Thank you!

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,165

    Re: Countifs but exclude a particular reference

    Hi Lisa and welcome to the forum,

    Strike Through is a Font and you can check for that in VBA. See the attached with a user defined function that might get close to what you want.
    UDF Count of NonStrike for Lisa.xlsm
    Here is the code. Some other Guru will do this in shorter steps, but I think this makes sense.
    Please Login or Register  to view this content.
    My code only looks in Column A for the count function. If your worksheet is different then we need to look at it to get the function correct.
    Last edited by MarvinP; 12-16-2022 at 02:43 AM.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,514

    Re: Countifs but exclude a particular reference

    Quote Originally Posted by lisa.pugh View Post
    My issue is I want to count a specific name in my array without the strike.
    UDF Use in cell like
    =CountIfFontAttr(A1:A14,A1,"StrikeThrough",FALSE)

    You can also change it like
    =CountIfFontAttr(A1:A14,A1,"StrikeThrough",FALSE,"Bold",True,"ColorIndex",3)

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-15-2022
    Location
    Seattle, WA
    MS-Off Ver
    8
    Posts
    2

    Re: Countifs but exclude a particular reference

    You are both angels! Thank you so much! I need to refence cells from another sheet and consider other factors in my count. Jindon's worked the simplest for what I needed to accomplish. I appreciate the help! One more question - with the UDF in place, the whole workbook runs slowly even if I'm entering data into a completely different sheet. Is that normal?

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,514

    Re: Countifs but exclude a particular reference

    Loop through the range getting cell attributes take time, so not recommended.
    Adding one column/row to mark, or something else to identify the target would be better.

+ 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] Countifs, reference cell and countifs from multiple tabs
    By rayted in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-22-2022, 04:30 AM
  2. [SOLVED] CountifS for Column Reference, Row Reference and Data Validation Reference
    By pavanbhoyar in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-24-2018, 02:37 AM
  3. [SOLVED] exclude certain words from a COUNTIFS formula
    By R.Sloan in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-26-2017, 03:40 AM
  4. [SOLVED] Sumproduct to replace countifs as countifs don't work on external source reference
    By KrishnaSagar in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-02-2017, 02:33 AM
  5. Countifs - How to exclude data
    By Ex Hell in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-29-2016, 10:39 AM
  6. [SOLVED] Using Countifs that can exclude 0 values
    By Ex-xcel in forum Excel General
    Replies: 5
    Last Post: 09-28-2016, 01:59 PM
  7. Exclude blank cells from COUNTIFS formula
    By Leahsco in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 08-05-2014, 11:45 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