Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
nickclingan
 
Posts: n/a
Default Can I make if functions based on fill color?


Hi, and thanks in advance for considering my question. Basically I need
to be able to sum a range of values in a very large spreadsheet based on
whether or not the cells have a fill color. I've tried looking up the
help files on if and sumif but they don't specify whether or not this
is possible... Anyone know? :)


--
nickclingan
------------------------------------------------------------------------
nickclingan's Profile: http://www.excelforum.com/member.php...o&userid=28623
View this thread: http://www.excelforum.com/showthread...hreadid=482862

  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default Can I make if functions based on fill color?

You can but it is flawed as a colour change does not trigger worksheet
recalculation

Function GetColorindex(rng As Range)
GetColindex = rng.Interior.Colorindex
End Function

=If(GetColorindex(A2)=3,1,0)



--

HTH

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


"nickclingan"
wrote in message
...

Hi, and thanks in advance for considering my question. Basically I need
to be able to sum a range of values in a very large spreadsheet based on
whether or not the cells have a fill color. I've tried looking up the
help files on if and sumif but they don't specify whether or not this
is possible... Anyone know? :)


--
nickclingan
------------------------------------------------------------------------
nickclingan's Profile:

http://www.excelforum.com/member.php...o&userid=28623
View this thread: http://www.excelforum.com/showthread...hreadid=482862



  #3   Report Post  
L. Howard Kittle
 
Posts: n/a
Default Can I make if functions based on fill color?

Maybe you can tweak this code to suit your needs. Sums the values of the
orange, red and green colored cells in a named range, "Data". Does not work
if cell color is due to conditional formatting. Dave McRitchie has a site
that deals with this very thing on the professional level, but I misplaced
the link, sorry.

Sub SumColorCount()
Dim Orange46 As Integer, _
Red3 As Integer, _
Green4 As Integer
Dim Cell As Range

For Each Cell In Range("Data")
If Cell.Interior.ColorIndex = 46 Then
Orange46 = Orange46 + Cell.Value
ElseIf Cell.Interior.ColorIndex = 3 Then
Red3 = Red3 + Cell.Value
ElseIf Cell.Interior.ColorIndex = 4 Then
Green4 = Green4 + Cell.Value
End If
Next

Range("F10").Value = "Orange = " & Orange46
Range("F11").Value = "Red = " & Red3
Range("F12").Value = "Green = " & Green4

MsgBox " You have: " & vbCr _
& vbCr & " Orange " & Orange46 _
& vbCr & " Red " & Red3 _
& vbCr & " Green " & Green4, _
vbOKOnly, "CountColor"

Range("F10").Value = ""
Range("F11").Value = ""
Range("F12").Value = ""
End Sub

Regards,
Howard

"nickclingan"
wrote in message
...

Hi, and thanks in advance for considering my question. Basically I need
to be able to sum a range of values in a very large spreadsheet based on
whether or not the cells have a fill color. I've tried looking up the
help files on if and sumif but they don't specify whether or not this
is possible... Anyone know? :)


--
nickclingan
------------------------------------------------------------------------
nickclingan's Profile:
http://www.excelforum.com/member.php...o&userid=28623
View this thread: http://www.excelforum.com/showthread...hreadid=482862



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
Sum by fill color Dee Excel Worksheet Functions 3 August 10th 05 07:47 PM
Cell color based upon cell value My View Excel Discussion (Misc queries) 11 July 6th 05 03:59 AM
Is there a way to color the cells based on the numeric value? ajyourpal Excel Worksheet Functions 1 June 24th 05 08:21 PM
make a cell empty based on condition mpierre Charts and Charting in Excel 2 December 29th 04 01:01 PM
A different "Fill Color" problem JKD Excel Worksheet Functions 1 November 1st 04 10:21 PM


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