Macro To Color Cells Based On Criteria

Jul 27, 2009

Column DColumn EColumn FTarget %DifferenceCash4%5.12%Large-Cap8.5%1.73%Commodities4%-1%

I need to color code Col F based on the following criteria:

If F2/E2>20%, then shade pink else no color. I only care about the absolute values. The 20% number can change depending on the category. So for commodities, the limitation is 30%. Like that I have a list of about 20 asset classes, 14 of which have the 20% constraint, rest are either 25% or 30%. I would like the cell color to be updated each time I import a file. Also I have other conditional formatting on Col F (like red color if negative number) so I don't know if another conditional format will work on the same cells?

View 9 Replies


ADVERTISEMENT

Macro To Color Cells Based On Their Font Color

Jun 18, 2008

I have a spreadsheet that i download from the net daily, which is seperated into columns of information.

I want to be able to look down a column and mark a cell in a seperate column if the cell font text is red.

For example looking down column A ... if the font text of a1 is red then mark the cell background colour of T1 red - if a2 text colour is red then mark the cell T2 red .... etc etc.

If the font colour in a1 or a2 ... etc etc is any other colour then do nothing.

I have 5 columns I wish to look down and mark in 5 seperate columns - I have tried to do this by conditional formating but don't know the fomula for checking font colour.

View 9 Replies View Related

Macro To Change Color Of Cells Based On Sum

Jul 26, 2014

When the sum of B7-D7 is less than cell (I7) I would like to change the shade of B7-D7 to orange to indicate that larger values need to be entered to equal the value of cell I7. And when the sum of these three cells does equal I7 their color should change to green. I recorded two macros to change the colors and I've run them to verify they work. But I've got something off in my simple macro below.

[Code] .....

View 4 Replies View Related

Macro That Will Auto Color Multiple Cells Based On Data Displayed In One Cell

Jan 7, 2013

I am trying to find a way to write a Macro that will auto color multiple cells based on what data is displayed in one cell. The cell I want to reference is a vlookup cell.

Basically this is a part label. And depending what part is selected from the list my vlookup will display its position on a vehicle(i.e.. FR, FL, RR, RL, Etc..). So if vlookup comes back with FR I want the various cells on the label to be orange, etc..

ALSO: if there is a way to embed it so it does this automatically (rather than run the macro each time).

View 7 Replies View Related

Excel 2010 :: Macro To Color Code Cells Based On Value In A Cell And Range In A Table

Dec 2, 2013

I am using Windows 7 and Excel 2010.

Is there a way to create a macro to color code a cell based on the value in a cell, and then look up a value in a table, then color code it based on where it fits into the table?

I have a table of values for about 30 projects. In column g - there is a CPI value (see bold column)

Example: Project ID
Name
Program
PMT
SI ID
AC
Milestone
TCP Level
[Code] ......

Here is the table:

I have to color code a cell, base on the CPI and how it fits into the table below. So if the current Milestone is M2 or M3 and the CPI calculated is .14 the cell would be colored RED, if the CPI number is 2.01 for M2-M3 I would want cell to be colored Turquiose. If we were at Milestone M6 and the CPI was 2.01, it would be colored blue. If the CPI was .75 at Milestone M5, it would be colored Green

LEGEND
Earned Value Limits

Milestone
RED
Yellow
Green
Turquoise
Blue

M2-M3
2.15

M4-M6
1.66

M7-M11
1.26

View 2 Replies View Related

Color Column Charts Based On Font Color Data Cells

Oct 27, 2009

I have attached the relevant spreadsheet for which I need to alter the color of the columns based on Site number ( Sheet 1). % Mortality will be represented in the Y-Axis, and the Site numbers would be on the X-Axis. All columns (% Mortality) except one will be of the same color, and the one of a different color will indicate a specific site. As an example, site 86 is colored differently. The way I require the chart to look is shown on Sheet 1.

After reading through some great posts on Ozgrid, I managed to do this using conditional formatting (Sheet 2), but that sort of falls short because I am required to add a data table to the chart, and the parameter that is indicated by the column bars happens to appear twice in the data table.

I was wondering if this can be automated maybe using VBA, but with the possibility of simply matching the color of columns with the font color of respective entry in the data series.

View 9 Replies View Related

Macro: Changing Color Of Coloumn Header Based On Rows Color

Jan 15, 2009

I wrote a macro to color the cell values in the rows based on their average value. For eg if the cell value is less than 0.2 Avg, they should be red color,if value is between 0.2 and 0.5 it should be yellow. This part is working fine

Now based on the color of the rows cells , need to write a macro for the header one. Logic is Coloum header should be in red colour, if in one or more number of rows cells are red. same with yellow ones. Could you please help me out in solving this with logic.

View 8 Replies View Related

Color Cells Based On Color Of Preceeding Cell

Nov 18, 2007

I am looking for a very simple script that will achieve the following:

On the clicking of a button, Select and shade in a cell yellow, delete the yellow shading of the previous cell. The shading & selection should move up a column of cells, 1 at a time, in the following order:

From B10 to B9, then B9 to B8, B8 to B7 etc until the selection and shading is at B2. Once it is at B2 subsequent clicks will simply keep it at B2 (the top). Thus after 8 clicks the shading & selection should travel from B10 to B2, with only 1 cell being shaded yellow and selected at any one time.

View 5 Replies View Related

Color Formula Result Based On Criteria

Jan 4, 2007

I would like to use formulas to display different results eg UNDERBUDGET - OK - OVERLIMIT etc. Ideally they would be shown using different colours & text size. I can't seem to change the colour/text size inside the formula for the different words - only for the whole cell.

View 2 Replies View Related

Color Cells Which Do Not Match Criteria-II

May 25, 2009

http://www.excelforum.com/excel-gene...-criteria.html target="_blank">Color Cells Which do not match criteria

i m having a problem similiar to the above.I tried using the nested ifs in Conditonal formatting but i m getting errors.Can anybody complete my formula

View 11 Replies View Related

Gantt Chart: Color Cells Dependent On Criteria

Dec 5, 2006

I have a list of task owners that are assigned tasks. The tasks are mapped out in Gantt chart form with time shown by an "X".

what I want to do is to colour the cells "X" with the associated cell colour of the task owner and should the owner change, the cell colour changes.

View 5 Replies View Related

Color Cells Where Cell Below Meets Date Criteria

Nov 21, 2007

I´m trying to do a macro that changes the color of all fonts in a row if the cell in the column "R" has the date lower than a specific one, something like this:

Dim Data2 As Date
Data2 = Sheets("Sheet1").Range("today")
Range("R12").Select
Do While ActiveCell <> ""
If ActiveCell < Data2 Then
ActiveCell.EntireRow.Select
Selection.Font.ColorIndex = 3
Else
ActiveCell.Offset(1, 0).Activate
End If
Loop

But it just don´t work. The macro does that in the first row, than it stops. Do you have another code for this, or another way to do?

View 7 Replies View Related

Select Row Based On Cell Criteria Remove All Formulas From Row And Change Fill Color

Apr 23, 2014

I have a worksheet that when a row changes based on the value of column B, I want to remove all of the formulas found in the row but keep the existing values, and then change the color of the row.

In the sample file attached, when the value is "Closed", that row will keep the existing values and then it gets grayed out. Rows that are still marked "Open" need to retain the formulas in case other information changes.

I have tried copy/paste special using autofiltering but that doesn't work because of the hidden lines. This file changes on a daily basis and I need a quick way to update the file.

SampleFile.xlsx

View 1 Replies View Related

Formula Within Conditional Formatting To Color Cells Meeting Criteria

Aug 25, 2009

I need to be able to get a macro to do this. I recorded the macro. The conditional worked, but when I cleared it and then ran the macro, it highlighted all of the wrong stuff. Here is what I want to do: In column(AJ) I have cities with Prefixes or not In another column (AV) I have Criteria1 and in yet another, I have criteria2 (CB)

City
(AJ) Criteria1 Criteria2
SCRNRTH_SCRM1 FALSETRUE should fail test
A9_SCRNRTH_SCRM1FALSETRUE
A9_SCRNRTH_SCRM1FALSETRUE
A9_SCRNRTH_SCRM1FALSEFALSE should fail test
SCRNRTH_SCRM1 TRUETRUE should fail test
A9_SCRNRTH_SCRM1FALSETRUE
SCRNRTH_SCRM1 FALSEFALSE
A9_SCRNRTH_SCRM1FALSEFALSE should fail test
A9_SCRNRTH_SCRM1FALSEFALSE should fail test
A9_SCRNRTH_SCRM1TRUETRUE should fail test
A9_SCRNRTH_SCRM1FALSETRUE....................

View 6 Replies View Related

Color Cells Based On Adjacent Cells Being Empty & Add Text

Apr 2, 2008

I’m trying to make my life a bit easier, by adding a few macros and formulas to the spreadsheet (Everything was done completely manually before I got here!!!).
What I would like to do is take two columns, which contain a start and end time for work shifts, and colour them GREEN once I have entered a name in the Worker column (Along side the two with the time), and also to fill a cell with a Yes or a No. I’m aware of auto conditioning, and I’ve tried to have a play to get this to work, but I just can’t work it out.
I have posted a link to an image which shows what I want. I hope I've explained it well enough!

http://img530.imageshack.us/img530/6239/excelspfk0.jpg

View 9 Replies View Related

Fill Cells Color In Worbook Based On Other Cells

Jan 27, 2005

how can I automatically fill cells with certain colors based on the value of the cell. (i.e. I want to search an entire workbook and fill cells with values between 80 and 99 green, 60 to 79 yellow and 0 to 59 red.)

View 9 Replies View Related

Color Cells Based On Multiple Conditions Of Different Cells

Jan 15, 2008

I’m trying to change color in cell B9 according to different conditions in Cell C9 (than on b10 according to c10 and so long until necessary - probably will be around 2000 lines). Since there are more than 3 conditions and in two cases condition depends on the color of the C Column, I can not use conditional formatting. I’ve searched and found similar forums here, but since I’m ignorant in VBA code, I couldn’t manage to make adjustments. So if you can help me with the code, I would really appreciate it!

Condition and Results required would be:

IF column C = “S” than on Column B = color cell light blue with white border
IF column C = “P” than on Column B = color cell Green with white border
IF column C = “A” than on Column B = color cell Yellow with white border
IF column C = “L” than on Column B = color cell Red with white border
IF column C = “C” than on Column B = color cell Dark Blue with white border
IF column C = “ ” than on Column B = color cell white
IF column C = “V” and has white background than on Column B = color cell white
IF column C = “V” and has a Dark Grey background than on Column B = color cell Dark Grey

I don’t know if the last two are feasible.

View 6 Replies View Related

Color Cells Based On Others

Jun 25, 2007

I have a long standing problem, i need to use some code that will search a range of cells , say j1 to j15, for a text "ship", gather the value from the equivalent h column cell and then use that value in futher code to colour some cells. So if the value returned is say 5, then colour the next 5 columns from column A whenever "ship" is typed.

View 9 Replies View Related

Color Cells Based On Value Above/Below

May 29, 2008

I have many cells in a column, where I would like to change the colour depending on the value in the cell above. If one cell is more than or equals 600 000 and the cell below is less than 600 000, then the lower cell should change colour to red.
This should be repeted for all cells in the column, until the last empty cell.

Sub macro()
x = 7
Do While Cells(x, 4).Value <> ""
If Cells(x, 4).Value >= 600000 _
And Cells([x + 1], 4).Value < 600000 Then _
Cells([x + 1], 4).Select _
Selection.Font.ColorIndex = 3
End If
x = x + 1
Loop
End Sub

For this code I receive the error code "Compile error: End if without block if".

View 7 Replies View Related

Color Cells Based On Difference Between Two Cells

Jun 3, 2008

I have a 2 lists of manually entered values where the values in each row are related. They are related in the sense that if the difference between them is equal to or less than, a given amount then the cell containing one value is colored Blue. e.g.

COl A holds Value x while COl B holds value y. I need to check which value is entered in columns A and B and if a given difference or greater exists colour the cell in COl B. For example the relationship relevant to a COL A value of 21.0 is 11.0.

So, I enter the following;

A1 B1

21.0 13.0 <----------------No color Blue

I enter new values

21.0 9.5 <----------------B1 is blue.........................

View 2 Replies View Related

Counting Cells Based On Color

Jun 19, 2013

Here's a link : [URL] .....

What I would like to do is create a column that will count the number of cells in each row whose background color is not red or yellow. The yellow background color was input manually, and the red background color was input through conditional formatting.

I have a spreadsheet full of GPS locations of different pumps on different dates. Each column represents a different pump, and each row represents a different date. The cells on this sheet contain one of two things - either a set GPS coordinates or the word "Repair" and a description of the repairs done. A few days ago I went through and checked the GPS coordinates to see which pumps were where every day during the past three years, and changed the background color of each cell containing GPS coordinates determined to be off-site to yellow. I then used conditional formatting to change the background color of each cell containing the word "Repair" to red. Now I need to go through and find out how many pumps were on location, not being repaired on each day.

Here's a link to a sample workbook. Any cell containing the word "GPS" just represents the fact that there are GPS coordinates in the cell. Their format is basically "(#####, #####)".

pump location example spreadsheet.xlsx

View 2 Replies View Related

Returning A Row Of Cells Based On A Color

Apr 25, 2007

I am having a bit of a problem writing a formula that works under the specific conditions that I need.

I have a range of 6 cells, A1:A6 which contain text
I have formatting that turns that row red based on specific conditions. The problem is that if A1:A6 is red, I then need the text in those cells to be copied to Sheet 2 B1:B6.

View 9 Replies View Related

Copy Cells Based On Color

Mar 10, 2006

i have att a workbook with 2 command buttons on sheet "quote"
one turns the selected cell red.
the other one i would to have select the red cells then copy to sheet1 then change the color back to white

View 9 Replies View Related

Sum Cells Based On Color Index

Nov 13, 2006

I am trying to use a function kindly listed by Dave, that allows for a SUM to be done on cells which have a certain color index. I have modified it very slightly, but unable to set the call to it without getting errors, perhaps someone can shed some light on what i am doing wrong. Dave's original code is

Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As Boolean)
Dim rCell As Range
Dim lCol As Long
Dim vResult
lCol = rColor.Interior.ColorIndex
If SUM = True Then
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = WorksheetFunction.SUM(rCell,vResult)
End If
Next rCell
Else
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = 1 + vResult
End If
Next rCell
End If
ColorFunction = vResult
End Function.......

View 4 Replies View Related

Count Cells Based On Cell Color

Apr 14, 2014

I would like to count the number of orange cells, Green cells, Blue cells in the attached spreadsheet.

I have attached the sample file.. In my original file the cell colors will be a result of some conditional formatting.

Color Count test.xlsx‎
Test2.xlsx

View 3 Replies View Related

Deleting Cells Based On Font Color

Sep 11, 2009

I am trying to delete certain cells within a range of data (A13:E29) that have white font or #N/A's. The only information I need is the black data. I have to manually go and clear these cells for many different ranges. I'd like to incorporate a macro that analyzes the range first to delete the values that are white font or #N/A.

View 4 Replies View Related

VBA To Change Font Color In Cells Based On Value

Dec 15, 2009

I'm using some basic code below in an on Workbook Open event to format cells with a value less then 2 and less than 1 with a particular color.

The code works, but it really slows my worksheet down when opening. Is there better way to write this?

Code:

Dim myRange As Range
Dim cell As Range
Set myRange = Range("V6:V50000")
For Each cell In myRange
If cell.Value < 2 Then cell.Font.ColorIndex = 5
If cell.Value < 1 Then cell.Font.ColorIndex = 3
Next

View 5 Replies View Related

Color Code Cells Based On Value In Row 1 And Value In Cell

Dec 26, 2007

I have 16 columns (B:Q)
Row 1 contains either a number, the letter x, or the letter a.
Cells in Range("B2:Q628) contains either the letter x or is blank

If a cell in row 1 contains an x, then all cells in that column with an x has an Interior.ColorIndex of 45

If a cell in row 1 contains an a, then all cells in that column with a blank has an Interior.ColorIndex of 45

If a cell in row 1 contains has a number, then nothing

View 9 Replies View Related

Count Cells Based On Font Color

Feb 23, 2009

Hi, I've been cracking my head for a few days your assistance is much appreciated.

Name SA1SA2SA3SA4SA5AYESNONOYESYESBYESNONOYESNOCYESNONOYESNODYESNONOYESYESEYESNONOYESYESFYESNONOYESNO

The ones in red is conditionally formatted. So I want at the end of each row to count how many are in red.

View 9 Replies View Related

Copy Cells Based On Fill Color

Sep 9, 2006

i have some problem in display the highlight cell to another worksheet. Below is in module, i would like to display the highlighter cell to another worksheet.

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 9/2/2006 by user
'

'
Range("I351").Select
ActiveWindow.SmallScroll Down:=-12
Range("I349").Select
ActiveWindow.ScrollRow = 1
Range("E1:E400").Select

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved