Solved

Excel -- need formula based on cell color

Posted on 2013-11-02
5
724 Views
Last Modified: 2013-11-02
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
Comment
Question by:ExpExchHelp
  • 3
  • 2
5 Comments
 
LVL 21

Expert Comment

by:CompProbSolv
ID: 39618905
0
 

Author Comment

by:ExpExchHelp
ID: 39618920
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
 
LVL 21

Accepted Solution

by:
CompProbSolv earned 500 total points
ID: 39618930
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
 

Author Closing Comment

by:ExpExchHelp
ID: 39618936
Thanks... that did the trick.  ;)
0
 
LVL 21

Expert Comment

by:CompProbSolv
ID: 39618963
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question