Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Summing a range if a certain background colour

I would like to be able to sum the numnber of times the cell background is
red in a range. I would also like to do it separately for the background
colour yellow, and separately for the background colour bright green. Ideally
I would like to do it without programming code but any solution very welcome.
I am using Excel 2003

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Summing a range if a certain background colour

You won't do it without programming. See
http://www.xldynamic.com/source/xld.ColourCounter.html for a solution, but
note the constraints.

--
HTH

Bob Phillips

" Inserting an option button in Word"
soft.com wrote in message
...
I would like to be able to sum the numnber of times the cell background is
red in a range. I would also like to do it separately for the background
colour yellow, and separately for the background colour bright green.

Ideally
I would like to do it without programming code but any solution very

welcome.
I am using Excel 2003

Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Summing a range if a certain background colour

Thanks Bob, I'll give it a try.

"Bob Phillips" wrote:

You won't do it without programming. See
http://www.xldynamic.com/source/xld.ColourCounter.html for a solution, but
note the constraints.

--
HTH

Bob Phillips

" Inserting an option button in Word"
soft.com wrote in message
...
I would like to be able to sum the numnber of times the cell background is
red in a range. I would also like to do it separately for the background
colour yellow, and separately for the background colour bright green.

Ideally
I would like to do it without programming code but any solution very

welcome.
I am using Excel 2003

Thanks.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Summing a range if a certain background colour

Bob, struggling with suggested solution. Tried pasting in code into sheet and
using sumproduct but Excel won't recognise ColorIndex part of formula. Not
sure what I'm doing wrong. Any help appreciated.

"Bob Phillips" wrote:

You won't do it without programming. See
http://www.xldynamic.com/source/xld.ColourCounter.html for a solution, but
note the constraints.

--
HTH

Bob Phillips

" Inserting an option button in Word"
soft.com wrote in message
...
I would like to be able to sum the numnber of times the cell background is
red in a range. I would also like to do it separately for the background
colour yellow, and separately for the background colour bright green.

Ideally
I would like to do it without programming code but any solution very

welcome.
I am using Excel 2003

Thanks.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Summing a range if a certain background colour

You need to paste the VBA procedure at the bottom of the page in
to a module in the VBA Editor. In the formulas on the page,
ColorIndex is a VBA function.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


" Inserting an option button in Word"
soft.com wrote
in message
...
Bob, struggling with suggested solution. Tried pasting in code
into sheet and
using sumproduct but Excel won't recognise ColorIndex part of
formula. Not
sure what I'm doing wrong. Any help appreciated.

"Bob Phillips" wrote:

You won't do it without programming. See
http://www.xldynamic.com/source/xld.ColourCounter.html for a
solution, but
note the constraints.

--
HTH

Bob Phillips

" Inserting an option button in Word"
soft.com
wrote in message
...
I would like to be able to sum the numnber of times the cell
background is
red in a range. I would also like to do it separately for
the background
colour yellow, and separately for the background colour
bright green.

Ideally
I would like to do it without programming code but any
solution very

welcome.
I am using Excel 2003

Thanks.








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Summing a range if a certain background colour

Thanks Bob, got it working, and to everyone for answers.

"Bob Phillips" wrote:

You won't do it without programming. See
http://www.xldynamic.com/source/xld.ColourCounter.html for a solution, but
note the constraints.

--
HTH

Bob Phillips

" Inserting an option button in Word"
soft.com wrote in message
...
I would like to be able to sum the numnber of times the cell background is
red in a range. I would also like to do it separately for the background
colour yellow, and separately for the background colour bright green.

Ideally
I would like to do it without programming code but any solution very

welcome.
I am using Excel 2003

Thanks.




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Summing a range if a certain background colour

Its not possible through a simple worksheet formula, here's a UDF which does
it.

Function myCount(countRng, refRng)
myCount = 0
For Each cl In countRng
If cl.Interior.ColorIndex = refRng.Interior.ColorIndex Then
myCount = myCount + 1
End If
Next
End Function

Usage:
=myCount($A$1:$A$10,A1)

You have to count in the range A1:A10. The second argument is the reference
range where you specify that cell which contains the required format.

Mangesh




" Inserting an option button in Word"
soft.com wrote in message
...
I would like to be able to sum the numnber of times the cell background is
red in a range. I would also like to do it separately for the background
colour yellow, and separately for the background colour bright green.

Ideally
I would like to do it without programming code but any solution very

welcome.
I am using Excel 2003

Thanks.



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Summing a range if a certain background colour

If you really don't want to use vba and it's ok to include a column of
helper cells, try this:

Select a cell offset from A1 relative to your colour cell and helper cell.
Eg, if you want a column that returns colours in cells one column to the
left, start by selecting B1.

Ctrl-F3, Define Names dialog
Names in Workbook: enter a name, eg FillColor
Refers to: =GET.CELL(63, A1)

If you want to return values in cells to the right, select A1 and change A1
in the formula to the appropriate relative offset.

To return the fill colorindex of C3, in D3 enter =FillColor. Copy down.

To count your bright yellow cells, use Countif, eg
=COUNTIF(D2:D8,6)

If you subsequently change the colour format, the formula will not update*.
But it should update with a full recalculate with Ctrl-Alt-F9.
* Some things, like sort, may update the formula.

VBA is more flexible, but the old XLM / name method much faster.

Regards,
Peter T

" Inserting an option button in Word"
soft.com wrote in message
...
I would like to be able to sum the numnber of times the cell background is
red in a range. I would also like to do it separately for the background
colour yellow, and separately for the background colour bright green.

Ideally
I would like to do it without programming code but any solution very

welcome.
I am using Excel 2003

Thanks.



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
Change background colour hollies Excel Worksheet Functions 3 October 8th 09 11:54 PM
Sheet Background Colour Kaye Excel Discussion (Misc queries) 2 February 12th 07 02:15 AM
change a cell background colour to my own RGB colour requirements Stephen Doughty Excel Discussion (Misc queries) 4 June 16th 06 01:08 PM
Background colour using VB Tom Ogilvy Excel Programming 2 September 15th 04 08:58 PM
Background colour using VB No Name Excel Programming 0 September 15th 04 02:51 PM


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