Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Sum a row of data based on FONT COLOR (

Alright, here's one for you. Sort of a wacky "SUMIF" function needed. Can
I conditionally sum a row of data in a worksheet if the font color is black?
Sample data


Column A Column B Column C Column D Column E Column F
(Normal Sum) Column G (Conditional color Sum)
1000(Black) 2000 (Red) 2000 (Black) 4000(Black) 1000(Green) 10,000
(1000+2000+4000)=7,000



Thanks for your help,
-Dave


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Sum a row of data based on FONT COLOR (

Hi
see: http://www.cpearson.com/excel/colors.htm

--
Regards
Frank Kabel
Frankfurt, Germany


RockNRoll wrote:
Alright, here's one for you. Sort of a wacky "SUMIF" function
needed. Can I conditionally sum a row of data in a worksheet if the
font color is black? Sample data


Column A Column B Column C Column D Column E
Column F (Normal Sum) Column G (Conditional color Sum)
1000(Black) 2000 (Red) 2000 (Black) 4000(Black) 1000(Green)
10,000 (1000+2000+4000)=7,000



Thanks for your help,
-Dave

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Sum a row of data based on FONT COLOR (

The following function will return the sum of cells in a
range that have either an Interior (background) or Font of
a specified color. InRange is the range of cells to
examine, WhatColorIndex is the ColorIndex value to count,
and OfText indicates whether to return the ColorIndex of
the Font (if True) or the Interior (if False).

Function SumByColor(InRange As Range, WhatColorIndex As
Integer, _
Optional OfText As Boolean = False) As Double
'
' This function return the SUM of the values of cells in
' InRange with a background color, or if OfText is True a
' font color, equal to WhatColorIndex.
'
Dim Rng As Range
Dim OK As Boolean

Application.Volatile True
For Each Rng In InRange.Cells
If OfText = True Then
OK = (Rng.Font.ColorIndex = WhatColorIndex)
Else
OK = (Rng.Interior.ColorIndex = WhatColorIndex)
End If
If OK And IsNumeric(Rng.Value) Then
SumByColor = SumByColor + Rng.Value
End If
Next Rng

End Function

You can call this function from a worksheet cell with a
formula like
=SUMBYCOLOR(A1:A10,3,FALSE)

-----Original Message-----
Alright, here's one for you. Sort of a wacky "SUMIF"

function needed. Can
I conditionally sum a row of data in a worksheet if the

font color is black?
Sample data


Column A Column B Column C Column D

Column E Column F
(Normal Sum) Column G (Conditional color Sum)
1000(Black) 2000 (Red) 2000 (Black) 4000(Black) 1000

(Green) 10,000
(1000+2000+4000)=7,000



Thanks for your help,
-Dave


.

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
More Functions based on Font Color michelle New Users to Excel 2 September 3rd 08 08:56 PM
Condition font color in a single cell based on its formula data. Bee Excel Worksheet Functions 3 February 19th 08 12:09 AM
Changing Font color based on font type or size John Excel Discussion (Misc queries) 2 February 7th 08 12:50 AM
change font color based on a value Golf Nut[_2_] Excel Worksheet Functions 1 April 26th 07 03:30 PM
How to sum data based on font or cell color? techiesol Excel Worksheet Functions 6 May 24th 06 04:11 PM


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