Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Costa
 
Posts: n/a
Default calculate numbers based on font color?


Is there a formula to calculate numbers based on their font color?

For example, say cells B1 to B10 all have numbers in them. Half the
numbers have a font color of Red and the other half Green.

I would like to total all the red numbers with a formula.
Is there a way to do this?

Thank You


--
Costa
------------------------------------------------------------------------
Costa's Profile: http://www.excelforum.com/member.php...o&userid=26980
View this thread: http://www.excelforum.com/showthread...hreadid=401912

  #2   Report Post  
Richard Buttrey
 
Posts: n/a
Default

On Mon, 5 Sep 2005 07:43:20 -0500, Costa
wrote:


Is there a formula to calculate numbers based on their font color?

For example, say cells B1 to B10 all have numbers in them. Half the
numbers have a font color of Red and the other half Green.

I would like to total all the red numbers with a formula.
Is there a way to do this?

Thank You


I don't know of a standard Excel Function, but you could write a
userdefined function in VBA to do this. One way would be:

Public Function SumRedFont(Myrange As Range)
Dim x As Integer, y As Integer
Dim MySum As Double

x = Myrange.Cells.Count

For y = 1 To x
If Myrange.Cells(y, 1).Font.ColorIndex = 3 Then
MySum = MySum + Myrange.Cells(y, 1)
End If
Next

SumRedFont = MySum

End Function


Then in say C1 you would enter the formula

=SumRedFont(B1:B10)

This assumes all cells are in one column, i.e. B. You'd need to modify
it slightly if the range was two dimensional.


HTH



__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________
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 2003 Font Color and Background Color DrankPA6 Excel Discussion (Misc queries) 1 August 12th 05 11:43 PM
changing font color for new text DanDavis Excel Discussion (Misc queries) 2 July 24th 05 04:17 PM
can i chart my data in the font color? larry Charts and Charting in Excel 1 June 11th 05 03:57 PM
Count based on color John Kirschner Excel Worksheet Functions 2 January 19th 05 02:27 PM
Identifying the Active Fill Color Steve Conary Excel Discussion (Misc queries) 3 December 9th 04 04:45 AM


All times are GMT +1. The time now is 03:00 PM.

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"