Color Cells Based On Other Cells
Dec 10, 2006I have an if statement and if it's true I would like to have the cell turn black as well as mark it with an "x"
View 7 RepliesI have an if statement and if it's true I would like to have the cell turn black as well as mark it with an "x"
View 7 RepliesI’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
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 RelatedI’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.
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.
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.........................
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.
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.
Conditional formatting. I want to change the color of a group of cells based on data in another group of cells. Example:
If cells G8 and G9 (which are merged) are between 80% and 94%, then I9,I10,I11 (which are merged) will turn Yellow. Also, under the same scenario, IF G8 and G9 is greater than 94%, then cells I9, I10, I11 will turn Red.
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 RelatedI 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".
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
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.
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
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.......
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
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] .....
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 RelatedI'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
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
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.
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?
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
I was hoping there was an alternative to having to use so many named ranges for each sublist (there would many sublists in the actual workbook). Anyway, I'm a little uncertain about the code you posted - do the LIST and SUBLIST codes go in Source in Data Validation, or in Source in Dependent Validation Lists Based On Header Values? Can you give me a bit more instruction on this? Also, I'm trying to use the following code to color cells upon a change in value in V1 or V2, but can't get it to work. Can you kindly tell me what's wrong with it?
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "V1" Or "V2" Then Exit Sub
Select Case [V1].Value
Case "A"
Target.Interior.ColorIndex = 40
Case "B"
Target.Interior.ColorIndex = 35
Case "C"
Target.Interior.ColorIndex = 36
Case "D"
Target.Interior.ColorIndex = 34
Case "E"
Target.Interior.ColorIndex = 19
Case "F"
Target.Interior.ColorIndex = 24
End Select
End Sub
I need to be able to count the # of green cells in a range independant of what is in the cell. I can't to do it in VBA.
View 5 Replies View RelatedI want to format a group of cells color based on the value of one referance cell. Example would be: If a1 is adn "X" the the results in cells b1 thru b10 would be green else they would be blue. Is there a way to do this using Excel 97?
View 3 Replies View RelatedWhat i want to do is based on values in a worksheet row to fill the corresponding columns with black color on another worksheet. E.g i have the first row filled with 1,3,5,6,8 then i want the second worksheet on the first row to have filled with black color the 1st,3rd,5th,6th,8th columns and nothing on the others. The same goes for the entire sheet.
View 2 Replies View Relatedcreate formula/condition to colour fill different cells based on multiple Criteria.
View 3 Replies View Relatedhow to sum/count cells based on background color [url]
how to delete cells based on background color?
I have a sheet contains information about employees absence:
- Staff number
- Staff name
- Date of Leave
- Date of Return
- Number of Days Lost