Formula for counting coloured cells.

hotrod

Board Regular
Joined
Feb 3, 2009
Messages
103
I have a table of numbers with conditional formating, formula's are...

=COUNTIF(OFFSET($W3:$AB3,1,0),W3+1)+COUNTIF(OFFSET($W3:$AB3,1,0),W3-1) - color, lemon.
=COUNTIF(OFFSET($W3:$AB3,-1,0),W3+1)+COUNTIF(OFFSET($W3:$AB3,-1,0),W3-1) - color, light blue.

Column AC, I want to count the number of cells that are lemon for each row.
Column AD, I want to count the number of cells that are light blue for each row.

Is it possible?
 
Last edited:
Hotrod

Not a problem at all, sorry for coming back to you so late.

In column F1 For the lemon Apply the following formula then paste down.
=SUMPRODUCT(COUNTIF(A2:E2,A3:E3-1))+SUMPRODUCT(COUNTIF(A2:E2,A3:E3+1))

In Column G6 the same, formula for blue is
=SUMPRODUCT(COUNTIF(A2:E2,A1:E1-1))+SUMPRODUCT(COUNTIF(A2:E2,A1:E1+1))

Please note, Row 1 must have a heading not the Numbers as per your example cause the blue checks Upwards, because there's no row above 1 you would get a ref# error.

Hope this helps, I've tested it on my side.

Cheers
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,216,759
Messages
6,132,555
Members
449,735
Latest member
Gary_M

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top