![]() |
How can I count the number of cells with a particular color/shade
I have a spreadsheet where I need to count the number cells with each of
these colors/shades: Yellow, Orange, and Red Thanks, Lynn |
How can I count the number of cells with a particular color/shade
I made a small typo
Function CountColors(Target As Range, CellColor As String) Select Case CellColor Case "Yellow" SearchColor = 6 Case "Red" SearchColor = 3 Case "Orange" SearchColor = 9 End Select CountColors = 0 For Each cell In Target If Range("A1").Interior.ColorIndex = SearchColor Then CountColors = CountColors + 1 End If Next cell End Function "Lynn" wrote: I have a spreadsheet where I need to count the number cells with each of these colors/shades: Yellow, Orange, and Red Thanks, Lynn |
How can I count the number of cells with a particular color/shade
You need a UDF function like the one below
Function CountColors(Target As Range, CellColor As String) Select Case CellColor Case "Yellow" SearchColor = 6 Case "Red" SearchColor = 3 Case "Orange" SearchColor = 9 End Select CountColors = 0 For Each cell In Target If Range("A1").Interior.ColorIndex = SearchColor Then CountColors = CountColors + 1 End If End If End Function "Lynn" wrote: I have a spreadsheet where I need to count the number cells with each of these colors/shades: Yellow, Orange, and Red Thanks, Lynn |
How can I count the number of cells with a particular color/shade
Hi,
You'll need a macro/UDF for this. have a look at Chip's site. http://www.cpearson.com/excel/colors.htm Dave url:http://www.ureader.com/msg/104234665.aspx |
All times are GMT +1. The time now is 10:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com