CountIF Formula if cell is yellow and has Satisfactory
Results 1 to 6 of 6

Thread: CountIF Formula if cell is yellow and has Satisfactory
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    May 2007
    Posts
    570
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default CountIF Formula if cell is yellow and has Satisfactory

    How would I got about writing a countif formula if the cell is yellow and has satisfactory 'text' in it? 2 Factors for count if please?

  2. #2
    Board Regular MARK858's Avatar
    Join Date
    Nov 2010
    Location
    Southern England
    Posts
    10,995
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    2 Thread(s)

    Default Re: CountIF Formula if cell is yellow and has Satisfactory

    You can't as a formula can't detect a colour, you either have to test for the condition that the cell is coloured based on or use a VBA function (and even then it depends whether your cell is coloured by fill colour or conditional formatting).
    Test VBA on a copy of your data (remember you can't normally reverse the action)

    Please follow the forum Rules and Guidelines & please use Code tags around your code i.e. [CODE]your code[/CODE]

    To post a screenshot try one of these links
    MrExcel HTML Maker, RoryA addin (Win & Mac) or Borders-Copy-Paste

  3. #3
    Board Regular
    Join Date
    May 2007
    Posts
    570
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default Re: CountIF Formula if cell is yellow and has Satisfactory

    I was trying to use the VBA code on the sheet which I googled and go from there in the countif formula option. Any idea how I would set something like this up to work?

  4. #4
    Board Regular MARK858's Avatar
    Join Date
    Nov 2010
    Location
    Southern England
    Posts
    10,995
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    2 Thread(s)

    Default Re: CountIF Formula if cell is yellow and has Satisfactory

    How is the cell coloured with a manual fill or conditional formatting?
    Test VBA on a copy of your data (remember you can't normally reverse the action)

    Please follow the forum Rules and Guidelines & please use Code tags around your code i.e. [CODE]your code[/CODE]

    To post a screenshot try one of these links
    MrExcel HTML Maker, RoryA addin (Win & Mac) or Borders-Copy-Paste

  5. #5
    Board Regular
    Join Date
    May 2007
    Posts
    570
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default Re: CountIF Formula if cell is yellow and has Satisfactory

    It's colored manually by another group.

  6. #6
    Board Regular MARK858's Avatar
    Join Date
    Nov 2010
    Location
    Southern England
    Posts
    10,995
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    2 Thread(s)

    Default Re: CountIF Formula if cell is yellow and has Satisfactory

    Try putting the code below in a regular module, then use the formula below.
    Please note that it will only pick up the standard yellow, if they don't use it then we can change the code so that it is based on one of the cells fill color.

    Code:
    Function ColorFunction(rRange As Range)
        Dim rCell As Range, vResult
        Application.Volatile
        
        For Each rCell In rRange
            If rCell.Interior.ColorIndex = 6 And rCell.Value = "satisfactory" Then vResult = 1 + vResult
        Next rCell
    
        ColorFunction = vResult
    End Function

    ABC
    1
    2
    3
    4
    53
    6satisfactory
    7
    8
    9
    10
    11
    12satisfactory
    13satisfactory
    14satisfactory
    15
    16
    17
    18

    Sheet4



    Worksheet Formulas
    CellFormula
    C5=ColorFunction(A1:A17)

    Last edited by MARK858; Aug 22nd, 2019 at 06:39 PM.
    Test VBA on a copy of your data (remember you can't normally reverse the action)

    Please follow the forum Rules and Guidelines & please use Code tags around your code i.e. [CODE]your code[/CODE]

    To post a screenshot try one of these links
    MrExcel HTML Maker, RoryA addin (Win & Mac) or Borders-Copy-Paste

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •