Colored Cells & Cell Formulas

MoltenPoo

New Member
Joined
Apr 24, 2002
Messages
6
Is there any way to utlized cell formulas to determine cell or text color? For example, if I have data populating A1:A5 and A1:A2 have a fill color of yellow and A3:A5 have a fill color of blue, can I use some formula with a "SUMIF" command to add by color?
 
These are all good options.
Also search the board, this has been covered
with lots of examples and site references.
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Will the UDF Colorsumif work for cells that are colored using conditional formatting? I've seen a few posts like this and they all give answers but warns that it doesn't work for conditionally formatted cell. Why is this the case?
 
Upvote 0
Conditional formatting doesn't operate the same, to put it mildly. I did post a couple of solutions (leveraging off of others, credit was posted respectively), but they only work on small ranges. You're better off testing the data for the same criteria that the was used to apply the format. To the matter at hand. Here's a udf to test, haven't tried Nimrod's, but if you want the recalc. to work properly, you need to mention that the function is volatile (vba style):

Code:
Function SumByColor(InputRange As Range, ColorRange As Range) As Double
Dim cl As Range, TempSum As Double, ColorIndex As Integer
Application.Volatile
ColorIndex = ColorRange.Cells(1, 1).Interior.ColorIndex
TempSum = 0
On Error Resume Next
For Each cl In InputRange.Cells
If cl.Interior.ColorIndex = ColorIndex _
Then TempSum = TempSum + cl.Value
Next cl
On Error GoTo 0
Set cl = Nothing
SumByColor = TempSum
End Function

Now use =sumbycolor(B1:F18,D1) where the first parameter is the test range and the second param is a cell that holds the format. This is leveraged from http://www.erlandsendata.no/english/functions/adding/sumbycolor.htm, but I've elected to add the volatility.

_________________
Cheers,<font size=+2><font color="red"> Nate<font color="blue">O</font></font></font>
wave.gif

This message was edited by NateO on 2002-05-11 11:51
 
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,446
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top