Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 131
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9,101
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9,101
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 100
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Any formula to count number of cells with a specific color pattern Stu Excel Worksheet Functions 2 November 16th 07 05:13 PM
How do I count the number of cells highlighted a certain color? KSB Excel Worksheet Functions 2 October 17th 07 04:29 PM
color/shade cell upon input MarkT Excel Discussion (Misc queries) 5 November 5th 05 02:22 PM
how to count number of cells in a color ? Francisco Excel Discussion (Misc queries) 4 September 25th 05 01:09 PM
HOW TO FORMATE CELLS TO COUNT CELLS WITH A FILL COLOR? Moore New Users to Excel 1 June 15th 05 06:41 PM


All times are GMT +1. The time now is 10:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"