Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How do you count colored cells?

I am working on a spreadsheet that counts my wins and losses regarding NFL
predictions. (i.e. marking the team name in red font which represents my
picks and yellow fill with the correct winner; the counting is needed to
tally up my wins and losses involving my predictions - teams with red font
and yellow fill = wins, teams with black font and yellow fill = losses)

I would like an answer that would allow me to use a function/formula
actually in Excel, not programming of some sort.

TIA
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default How do you count colored cells?

You can't count based on formatting using a standard function - you
will need some VBA to give you that functionality, unless your colours
are based on conditional formatting (which they don't seem to be from
your description).

Pete

On Nov 25, 1:31*am, Clueless78217
wrote:
I am working on a spreadsheet that counts my wins and losses regarding NFL
predictions. (i.e. marking the team name in red font which represents my
picks and yellow fill with the correct winner; the counting is needed to
tally up my wins and losses involving my predictions - teams with red font
and yellow fill = wins, teams with black font and yellow fill = losses)

I would like an answer that would allow me to use a function/formula
actually in Excel, not programming of some sort.

TIA


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default How do you count colored cells?

Hi,

Here is a custom function to count cells base on font color and fill color:

Function CountFormats(R As Range, E As Range) As Integer
Dim cell As Range
Dim Total As Integer
Application.Volatile
Set S = E.Cells(1, 1)
Total = 0
For Each cell In R
With cell
If .Interior.ColorIndex = S.Interior.ColorIndex _
And .Font.ColorIndex = S.Font.ColorIndex Then
Total = Total + 1
End If
End With
Next cell
CountFormats = Total
End Function

In the spreadsheet you enter =countformats(A2:B7,D2) Where A2:B7 is the
range you want to check and D2 is a cell formatted to the desired format.

To add this code to a workbook press Alt+F11 and select your file in the
Project explorer in the top left side of the screen. Choose Insert, Module.
Put the code in the resulting module.

If this helps, please click the Yes button

Cheers,
Shane Devenshire

"Clueless78217" wrote:

I am working on a spreadsheet that counts my wins and losses regarding NFL
predictions. (i.e. marking the team name in red font which represents my
picks and yellow fill with the correct winner; the counting is needed to
tally up my wins and losses involving my predictions - teams with red font
and yellow fill = wins, teams with black font and yellow fill = losses)

I would like an answer that would allow me to use a function/formula
actually in Excel, not programming of some sort.

TIA

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
count colored cells in excel Maddog Excel Worksheet Functions 5 October 9th 08 07:40 PM
Is there a way to count the number of different colored cells? MCM Excel Worksheet Functions 1 November 21st 06 06:16 PM
count colored cells? DKY Excel Worksheet Functions 21 January 19th 06 09:47 PM
Count non-colored cells Ken G Excel Discussion (Misc queries) 3 January 2nd 05 12:42 PM
Count or sum colored cells brightgirl Excel Worksheet Functions 2 December 7th 04 03:34 PM


All times are GMT +1. The time now is 11:20 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"