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

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,216,112
Messages
6,128,901
Members
449,477
Latest member
panjongshing

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