Share via

I am trying to count all cell in green fill color using this simple formula =COUNTIF(A1:C10,CELL("color",A1)=3)but always getting an error. do you know why?

Anonymous
2023-12-02T00:27:53+00:00

To count all cells with green fill color in a table, you can use the following formula:

=COUNTIF(range,CELL("color",cell)=3)

Replace range with the range of cells you want to count, and cell with the reference to a cell within that range.

Here's an example:

=COUNTIF(A1:C10,CELL("color",A1)=3)

This formula will count all cells in the range A1:C10 that have a green fill color.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-12-02T01:46:26+00:00

    Hi Daniyar,

    Thanks for contacting us,

    It seems like you are trying to use the CELL function with the COUNTIF function to count cells with a specific fill color. However, there's an issue with the syntax of your formula.

    The correct formula would be:

    =COUNTIF(A1:C10,CELL("color",A1)=3)
    

    In this formula:

    • A1:C10 is the range you want to count cells in.
    • CELL("color", A1) returns the color index of the cell A1.
    • =3 checks if the color index is 3, which typically corresponds to the color green.

    Make sure you are entering the formula correctly, and if you are still encountering errors, there may be variations in how different versions of Excel handle the CELL function for color. In some versions, you might need to use GET. CELL instead of CELL.

    Here is an example using GET. CELL:

    =COUNTIF(A1:C10,GET. CELL(63,A1)=3)
    

    In this formula, GET. CELL(63, A1) returns the color index of the cell A1, and =3 checks if it's the green color index.

    Please try these variations and see if they work for you.

    I hope this helps!

    Regards, Sola

    30+ people found this answer helpful.
    0 comments No comments