Count Colored Cells

jaybwise

New Member
Joined
Nov 3, 2011
Messages
2
I need to tell excel to count the colored cells ranging from D3 thru L123, then give me a percentage of the cells that are colored. any help is appreciated.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
You can use VBA like this:
Code:
Public Sub ColorPercent()
Dim r As Range
Dim iCount As Integer
Dim sPercent As Single
iCount = 0
For Each r In Range("D3:L123")
If r.Interior.ColorIndex <> -4142 Then iCount = iCount + 1
Next r
sPercent = (iCount * 100 / Range("D3:L123").Count)
MsgBox sPercent
End Sub
 
Upvote 0
OK. Here's a youtube video about VBE.
http://www.youtube.com/watch?v=k8um4v7T8VY

1. Open Excel File where you need to implement this code.
2. Press ALT+F11 to open Visual Basic Editor Window.
3. Insert a module using Insert >> Module.
4. Select the code and Paste it in Blank Pane in the right side.
5. And then choose File >> Close and Return to Excel.

In Excel, open the sheet where you want to check percent. Then Press ALT+F8 to open Run Macro dialog. Select the macro "ColorPercent" and Run it.
 
Upvote 0

Forum statistics

Threads
1,214,865
Messages
6,121,988
Members
449,060
Latest member
mtsheetz

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