Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Murph
 
Posts: n/a
Default Count if font color..

Can excel sum certain cells according to font color?

i.e. cash back expenses listed in red - summed to cell E4
credit card purchases listed in blue - sum to cell F4

the user manipulates the font color during input. But all values are listed
in a Mon-Fri G1-K1 area


  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

See http://www.xldynamic.com/source/xld.ColourCounter.html

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Murph" wrote in message
...
Can excel sum certain cells according to font color?

i.e. cash back expenses listed in red - summed to cell E4
credit card purchases listed in blue - sum to cell F4

the user manipulates the font color during input. But all values are

listed
in a Mon-Fri G1-K1 area




  #3   Report Post  
Dnereb
 
Posts: n/a
Default


Murph Wrote:
Can excel sum certain cells according to font color?

i.e. cash back expenses listed in red - summed to cell E4
credit card purchases listed in blue - sum to cell F4

the user manipulates the font color during input. But all values are
listed
in a Mon-Fri G1-K1 area



Not as a command but you can write a function to do it for you in VBA

like:


Code:
--------------------
Option Explicit

'constants to adapt the code easily if you want to use it for a difrent range or targetcells
Const FirstRow = 1
Const LastRow = 1
Const FirstColumn = 7 '(= "G")
Const LastColumn = 11 '(="K")

Const BlueFontTotalrow = 4
Const RedFontTotalrow = 4
Const BlueFontTotalColumn = 5
Const RedFontTotalColumn = 6



Sub AddOnFontColor()

'declar variable to count the rows and columns
Dim Rw As Long, Col As Long

'Variable to store the totals while counting
Dim RedSum As Double
Dim BlueSum As Double

'loop through the rows and columns
For Rw = FirstRow To LastRow
For Col = FirstColumn To LastColumn
'add the cells value to redsum if font is red
If Cells(Rw, Col).Font.Color = vbRed Then _
RedSum = RedSum + Cells(Rw, Col).Value

'add the cells value to bluesum if font is blue
If Cells(Rw, Col).Font.Color = vbBlue Then _
BlueSum = BlueSum + Cells(Rw, Col).Value

Next 'column
Next 'row

'place the totals in the desired cells
Cells(BlueFontTotalrow, BlueFontTotalColumn).Value = BlueSum
Cells(RedFontTotalrow, RedFontTotalColumn).Value = RedSum


End Sub
--------------------


--
Dnereb
------------------------------------------------------------------------
Dnereb's Profile: http://www.excelforum.com/member.php...o&userid=26182
View this thread: http://www.excelforum.com/showthread...hreadid=395901

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
Change Font Color Based on Classification sip8316 Excel Discussion (Misc queries) 3 June 2nd 05 07:15 PM
How do I change the font color of my sheet tabs? DungeonsOfAlcatraz Excel Discussion (Misc queries) 1 January 3rd 05 09:19 PM


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