Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
A formula to type 1 in B2 if A2 has the color green?
Is there a way to make a formula that recognizes the cell color like if A2 is
green, then my formula in B2 would recognize this color and return the value 1, then 0 for yellow and -1 for red for example. - a form of reverse conditional formatting. If not, how to to this in vba? Rgds |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
A formula to type 1 in B2 if A2 has the color green?
There's nothing built into excel that does this.
But you can use a UDF that looks at cells and returns the color. But that function won't recalculate if you change color. You won't be able to trust the output until excel recalculates. If you want to use a UDF like this, you can visit Chip Pearson's site: http://www.cpearson.com/Excel/colors.aspx Henrik wrote: Is there a way to make a formula that recognizes the cell color like if A2 is green, then my formula in B2 would recognize this color and return the value 1, then 0 for yellow and -1 for red for example. - a form of reverse conditional formatting. If not, how to to this in vba? Rgds -- Dave Peterson |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
A formula to type 1 in B2 if A2 has the color green?
Try the below UDF; will return the color index of a cell
=GetColorIndex(A1) will return 0 if not filled. Now you can combine this with IF formula to suit your requirement. Function GetColorIndex(varRange) GetColorIndex = varRange.Interior.ColorIndex If GetColorIndex = -4142 Then GetColorIndex = 0 End Function If this post helps click Yes --------------- Jacob Skaria "Henrik" wrote: Is there a way to make a formula that recognizes the cell color like if A2 is green, then my formula in B2 would recognize this color and return the value 1, then 0 for yellow and -1 for red for example. - a form of reverse conditional formatting. If not, how to to this in vba? Rgds |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Change the color in a chart, so POSITIVE values is e.g. GREEN and | Charts and Charting in Excel | |||
Change a cell color based on a certain value (green or red) | Excel Worksheet Functions | |||
conditional formatting COLOR - pale green | Excel Discussion (Misc queries) | |||
I want the bar chart with customer selected colors, green color f. | Charts and Charting in Excel | |||
Format color - darker green available? | Excel Worksheet Functions |