Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 764
  • Last Modified:

Excel -- need formula based on cell color

Experts:

I'm using  a module that scans for certain patterns across thousand of rows.

If a pattern is found, the macro applies a cell background color = yellow to each record (columns A:X) .

For another activity, I now would like to use a formula to identify those records.  For example:

=If(A1=Yellow,"Error","Ok")   How can this be accomplished?

Thanks,
EEH
0
ExpExchHelp
Asked:
ExpExchHelp
  • 3
  • 2
1 Solution
 
ExpExchHelpAuthor Commented:
Not sure if those posts address what I'm looking for.

Probably my fault for not further elaborating.

If a cell (A1) color is yellow, I'd like to display in AB1 either "Yellow" or "X" or anything that can be used by another formula to differentiate between white and yellow cells.

Thanks,
EEH
0
 
CompProbSolvCommented:
Those links refer to using VBA and not a cell formula.  This one will show you how to create such a function:
http://en.kioskea.net/faq/6606-excel-formula-based-on-the-color-of-cell

The fourth post here may be helpful:
http://www.ozgrid.com/forum/showthread.php?t=82173

I think that creating the function is a better solution.
0
 
ExpExchHelpAuthor Commented:
Thanks... that did the trick.  ;)
0
 
CompProbSolvCommented:
I played with this a bit and came up with the following function:

Public Function dispColorIndex(targetCell As Range) As Variant

    dispColorIndex = targetCell.Interior.colorIndex
           
End Function

For your situation, put the following in B1:
=dispColorIndex(A1)

Do note that the formula does not automatically update.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now