Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Rob
 
Posts: n/a
Default How do I sort or count cells by fill color?

I have a spreadsheet that contains pasted data from an online database. The
imported cells are color coded with RED, YELLOW, and GREEN fill. I would
like an automated way to calculate the number of RED, YELLOW, and GREEN cells
in the data. Any thoughts?
  #2   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default How do I sort or count cells by fill color?

Hi

Have a look he
http://www.cpearson.com/excel/colors.htm

Andy.

"Rob" wrote in message
...
I have a spreadsheet that contains pasted data from an online database.
The
imported cells are color coded with RED, YELLOW, and GREEN fill. I would
like an automated way to calculate the number of RED, YELLOW, and GREEN
cells
in the data. Any thoughts?



  #3   Report Post  
Posted to microsoft.public.excel.misc
L. Howard Kittle
 
Posts: n/a
Default How do I sort or count cells by fill color?

Chip's site will give you everything to do that. For grins, here's my shot
at it. Adjust to suit your range.
Will not work if color is from conditional formatting.

Sub ColorCount()
'Counts the number of colored
'cells in a range named Data.
Dim Blue5 As Integer
Dim Red3 As Integer
Dim Green4 As Integer
Dim Yellow6 As Integer
Dim Cell As Range

For Each Cell In Range("Data") '("B1:F11")
If Cell.Interior.ColorIndex = 5 Then
Blue5 = Blue5 + 1
ElseIf Cell.Interior.ColorIndex = 3 Then
Red3 = Red3 + 1
ElseIf Cell.Interior.ColorIndex = 4 Then
Green4 = Green4 + 1
ElseIf Cell.Interior.ColorIndex = 6 Then
Yellow6 = Yellow6 + 1
End If
Next

Range("A1").Value = Blue5 & " Blue"
Range("A2").Value = Red3 & " Red"
Range("A3").Value = Green4 & " Green"
Range("A4").Value = Yellow6 & " Yellow"

MsgBox " You have: " & vbCr _
& vbCr & " Blue " & Blue5 _
& vbCr & " Red " & Red3 _
& vbCr & " Green " & Green4 _
& vbCr & " Yellow " & Yellow6, _
vbOKOnly, "CountColor"
End Sub

HTH
regards,
Howard

"Rob" wrote in message
...
I have a spreadsheet that contains pasted data from an online database.
The
imported cells are color coded with RED, YELLOW, and GREEN fill. I would
like an automated way to calculate the number of RED, YELLOW, and GREEN
cells
in the data. Any thoughts?



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
Excel sort by Fill Color by custom list sort Dash4Cash Excel Discussion (Misc queries) 2 July 29th 05 10:45 PM
HOW TO FORMATE CELLS TO COUNT CELLS WITH A FILL COLOR? Moore New Users to Excel 1 June 15th 05 06:41 PM
Count Position of Filtered TEXT cells in a column Sam via OfficeKB.com Excel Worksheet Functions 0 May 15th 05 08:14 PM
Excel 2003 will not display color fonts or color fill cells DaveC Excel Worksheet Functions 1 April 11th 05 04:38 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 12:23 AM.

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

About Us

"It's about Microsoft Excel"