Solved

Excel -- need formula based on cell color

Posted on 2013-11-02
5
741 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 

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

After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
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.

623 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