Formula To Add A Value To A Cell - Based On Cell To The Left Color

Dec 10, 2013

I would like to add a value to a cell. The value in this cell will either be 1, 2, 3 or 4.

The value of this cell needs to be "1", if the cell to its left is "Red".
The value of this cell needs to be "2", if the cell to its left is "Purple".
The value of this cell needs to be "3", if the cell to its left is "Green".
The value of this cell needs to be "4", if the cell to its left is "Blue".

I believe I need to find the HEX values for the colors, but that is no problem, I just need the formula of the function if you know it.

View 11 Replies


ADVERTISEMENT

Format Cell To Be Normal Color Unless Cell Left Of It Not Empty

Apr 23, 2014

How to format a cell to be normal color unless cell left of it is not empty and this cell is empty.

And I need to format whole sheet to this rule.

View 1 Replies View Related

Highlight Given Color On Left Cell Of Dropdown List?

Mar 19, 2012

Column B contains dropdown list with 7 items in it. When an item is selected from the dropdown list I would like to highlight cell in the column A of the same row. Different color needs to be highlighted for every items.

View 1 Replies View Related

Conditional Formatting - Cell Color Based On Range Of Cell Color

Aug 9, 2013

Summary of performance of various products against target is as follows,

Product vs Target
Color Code
Result

CH4OH
Green
1.0

[Code] ........

I need the final result automated as follows,

If 2 green of the 4 products, then final result Gree
If 2 Amber of the 4 products, then final result amber
If 2 Red of the 4 products, final result Red

Is there a way to automate this?

View 8 Replies View Related

Formula Needed To Format A Cell When Its Value Is 0.2 Less Than The Cell To The Left

Apr 27, 2009

Is it possible to do the following?

if cell A1 = 6 and cell A2 =5.8 (0.2 below A1) colour cell A2 orange

if cell A1 = 6 and cell A2 =5.5 or below (0.5 or more below A1) colour cell A2 red

if cell A1 = 6 and cell A2 =6.2 / 6.5 / 6.8 (0.2/0.5/0.8 above A1) colour cell A2 green

if cell A1 = 6 and cell A2 =7.2 or above (1.2 or above A1) colour cell A2 green

View 9 Replies View Related

Color Cell Fonts Based On Text Color Of TextBox Controls On UserForm

Apr 11, 2008

I have got a userform with lots of controls,

One of the action's on a large group of the controls is the same but except for one number

here is an example

If TextBox107.ForeColor = 255 Then ActiveCell. Offset(0, 53).Font.ColorIndex = 3
If TextBox108.ForeColor = 255 Then ActiveCell.Offset(0, 54).Font.ColorIndex = 3
If TextBox109.ForeColor = 255 Then ActiveCell.Offset(0, 55).Font.ColorIndex = 3

This makes a cell that correlates to the textbox red if the text in the textbox is red.

Now, I loads of these textboxes that all need to run the same code with just the Offset value one digit higher than the last and I was hoping I could create a loop to avoid a huge block of code but I can't work out how to make a constant that will +1 with each loop.

Also, can I assume that a loop will start with the control with the lowest number i.e. Textbox1 and then work its way through the rest of them in order?

View 3 Replies View Related

Setting Color Of Range Based On Adjacent Cell Color

Nov 1, 2009

This is probably elementary, but I'm struggling and would appreciate any help as I have very little excel VBA experience to draw from.

I have assembled code which changes the cell color based on a value change in Column A. Column A will contain many different groups of repeating values. This code works well and and I have been able to figure out how to limit the number of colors to only 2. The end result is each set of similar values in column A is visually grouped by one of two alternating colors.

The number rows in the data set is variable as the data set is extracted from SAP. The number of columns is fixed.

What I want to do now is set the cell color in columns B through F the same color that was assigned to the row in column A. So if cell A3 is set to colorindex = 6, then I want to set the range of cells B3 to E3 to the same color.

Here is the code I am using to set the color of the cells in Column A:

View 7 Replies View Related

Change Font Color Based On Adjacent Cell Color

Apr 18, 2008

I have two columns. The first one (A) contains cells that have different Fill colors. The second column (B) contains text adjacent to the colored cells. I am trying to change the color of the text in the second column (B) to the corresponding color in the adjacent cell in the first column (A). I don't think conditional formating works well in this situation. I believe the solution would be some sort of macro.

View 3 Replies View Related

Change Text Color Based On Cell Color

Oct 17, 2006

I have various row cells in column (F) filled with the color Green. And corresponding text in Column G. How can I change the text of that particular row to white.

i.e.: if any cell in column F is Green, change the text color of that row in Column G to white?

View 5 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

Format Borders Based On Value In Far Left Cell

Jun 9, 2008

Is there a way to format any row in the workbook based on text value in VBA?

e.g. If I type "BLANK" in any row of a worksheet, then the certain cells in that particular row will Format Borders xlDiagonalUp (D:G,K).

View 5 Replies View Related

Excel 2010 :: Copy Data From One Cell Based On Color Of Another Cell To Different Worksheet

Jan 30, 2014

I have an Excel 2010 spreadsheet consisting of many worksheets (20 or so). Each of these worksheets contain detail level data regarding different projects. One of the columns in these worksheets is the 'Status' column (column F). There is conditional formatting on this column where if the text is 'G' then change background to a green color, 'Y'=yellow, 'R'=Red and 'U'=Grey.

The first worksheet is a summary sheet that I would like to pull information from each of the detail worksheet's columns B, D, E, G and H if the status column (Column F) is 'R' or 'Y'.

The number of rows in the detail worksheet can change each week (as few as 0 and as many as 100)

View 2 Replies View Related

Conditional Formatting - Change Cell Color Based On Date In Another Cell

Oct 9, 2013

I have two columns. In column B is the date of "last check". I column A is the date of "next check". I would like to have cell A2 in yellow color 334 days after the date entered in cell A3 and than in red color 365 days after the date entered in cell A3. Same thing for cell B2 related to date entered in cell B3. Yellow color in cells announces that check will expire within 30 days and red color that check has been expired.

View 1 Replies View Related

Changing Cell Background Color In Another Sheet Based On Cell Value

Jun 13, 2013

I am working on a workbook with 200+ sheets and an index linking to each of the sheets. On the sheets there is a cell containing the results of calculations and I need the cell referencing the sheet in the index to change background colors depending if the calculations value is greater or less than 0. I currently have working code that also changes the tab color of each sheet depending on the value, but i am trying to add the index cell background change functionality into that. also, the index listings is subject to change. my working code is

VB:

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("d34").Value < 0 Then
Me.Tab.ColorIndex = 3
ElseIf Range("D34").Value > 0 Then
Me.Tab.ColorIndex = 4
Else

[Code]...

and the code i am trying to get working is

VB:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngX As Range
Set myRange = Worksheets("Index").Range("A1:A500").Find(Range("C2").Text, lookat:=xlPart)
' the C2 is the reference the title that would be on the index
If Range("d40").Value < 0 Then

[Code]....

I keep getting the runtime error '1004: application-defined error or object-defined error the thing is, i ran the cell background changing code in a normal macro before integrating it in my other worksheet code first and it worked fine. I have a little code experience, though not much in vba and I am unsure what the issue is. if there is another better way to accomplish what I'm tring to do, that would also be fine.

View 4 Replies View Related

Modify Cell Background Color Based On Cell Content

Jul 1, 2014

I am working on developing QR Codes using some MATLAB code and it would be really convenient if I could create an excel program which changed the background color of a cell containing a 1 to black and a cell containing a 0 to white.

View 2 Replies View Related

Macro: Changing Cell Color Based On Date In Cell

Jan 12, 2009

I did a search on this site and found some code I was looking for (see link:

http://www.excelforum.com/excel-prog...e-in-cell.html - Leith Ross's response code).

The code works perfectly, however, if I save the workbook with a different spreadsheet on top than the spreadsheet referred to in this code, I get an error message: Method 'Range' of object '_Worksheet' failed.

I should state that I did change "Private Sub Workbook_Open()" to "Private Sub Auto_Open()".

I assume I need to modify the code but am unsure as to how.

View 11 Replies View Related

Adding Color And A Value To A Cell Based On Contents In Another Cell

Apr 28, 2014

I have values in a number of cells. Next to them, if there was a value, regardless of what the value is, except blank or zero, i would like the cell to turn blue and if possible have a 1 in the cell.

I've used the conditional formatting, however, among the options, 'less than' is the closest to to getting the color right. The issue is that if the cell has nothing in it, it still colors the corresponding cell blue; because it is not less than the already blank cell. If it is blank, I don't want it to color the cell.

View 1 Replies View Related

Change Cell Color Based On Cell Content

Feb 12, 2010

I have a chart full of different names which I need to separate them by color when a specific entry is found in a Cell. For example the list has the store name "ZELLERS" + its branch number. (ex. ZELLERS #276 PL or ZELLERS #295 SL and so on). I would like to modify the below code so that It only check for the name ZELLERS and not the branch number. If it finds ZELLERS in any cell In the Range of C1:C500 then color it Red.

Below Code does that but I have to write the exact name as it appears in the cell otherwise it wont find it for me. Is there any way to resolve the issue? I am not an Excel Programmer but Only an Excel user.

Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("C1:C500")
If Intersect(Target, r) Is Nothing Then
Exit Sub
End If
On Error GoTo Endit
Application.EnableEvents = False
vals = Array("ZELLERS #276 PL", "ZELLERS #295 SL", "Gopher", "Hyena", "Ibex", "Lynx")
nums = Array(3, 46, 6, 3, 7, 4, 20, 10, 23, 15)
For Each rr In r..........................

View 9 Replies View Related

IF(VLOOKUP) Formula That Also Copies Cell Background Color To Target Cell

Jul 4, 2014

I am currently using this Formula to Search a table on sheet 2 (Tabelle2) and copy the date in the relevent cell (Cells) into the correct cell on Sheet 1 (Master Sheet).

[Code] ..........

Used in cells E10:AZ30 and E33:AZ46

This works perfectly and is the formula behind all relevent cells in Sheet 1.

I would like to keep this but to add that it also copies the background color of the cell in Sheet 2 to the cell in sheet 1.

If i can Bring this Formula into VBA and add the color changing part, It must only work on the cells listed above..

View 9 Replies View Related

Excel 2010 :: Shifting Cells Left And Then Up If Left Cell Is Blank?

May 8, 2014

I have a 2010 excel sheet containing 14 columns and 45082 rows in total. I am quite illiterate when it comes to writing macros but I know that what I need can be achieved with a set of codes.

To be more clear, I inserted two tables below. The first one represents the current data structure, and the second one is the way I want my data to look like.

Current data structure looks like
Variable 1
Variable 2
Variable 3

[Code].....

View 9 Replies View Related

Color Code A Cell Based On Another Cell Using For Each

May 5, 2014

I'm writing some VBA code for Excel. I need to change the color of a cell based upon the data in another cell. This selects sheet "Kane", and searches for the word "Expenses" in a range in column D. Using For-Each, I need the IF statement that will change the cell color in the same row, but in column P.

View 4 Replies View Related

Changing Cell Color Based On Cell Name

Feb 11, 2010

I have a work sheet with over 500 different name enteries. I need to change the cell color to red if the cell has the name "john" in it. The names are listed in a column (ex. A1:A500)

The cell could have the name "John Jackson", "John Johnson", "John A", or just "John". As long as the name "John" is found, the cell color should turn red.

If the cell has the name "Mike", "Mike A", "Mike Johnson" then change color to Green. Here I am looking for any cell that has the name Mike in it.

and so on ...

I have over 500 different names so Conditional formating won't help me here. I was wondering if I could do this with VBA coding.

View 9 Replies View Related

Color Sheet Tab Based On Cell Value & Name Cell

Apr 8, 2008

I want to change the color of worksheet tabs based on a cell's value. The following code works great, except I can only seem to get it to work when using "$A$1" as the cell's address. When I give the cell a defined name at the sheet level it does not seem to work. I want to be able to use the same code on varying worksheets that will have the cell in different locations. How should I be calling the cell using the defined name?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
Select Case Target.Value
Case "Men"
Me.Tab.ThemeColor = 5
Case "Women"
Me.Tab.ThemeColor = 6
Case Else
Me.Tab.ThemeColor = 2
End Select
End If
End Sub

View 5 Replies View Related

Search For Cell That Has A Formula And Color Cell

Feb 26, 2009

I have this worksheet, that was created by some one else, that has formulas all over the place. What I want to do is click a button and have all the cells that contain a formula to change the font color to red and fill the cell with a certain color.

I am going to create a userform with one command button. I know the code will go in the command button.

View 2 Replies View Related

Get Cell Value From Another Cell Based On Color

Dec 5, 2012

If A1-A5 have the value 5 in them, but only A5 is filled with yellow color. How could I make another cell show only the value from the cell thats a certain color (yellow)?

View 1 Replies View Related

Cell Color Based On Another Cell

Nov 12, 2013

I want after entering data in a cell in the range that cell highlight color from column A in the same row.

For example:
If I type in a cell G14 data and after pressing the enter key the cell should highlight the same color as the cells in A14
If I type in a cell F10 data and after pressing the enter key the cell should highlight the same color as the cells in A10

View 9 Replies View Related

Color Cell Based On Other Cell Value

Jul 20, 2014

I would like to color the cell to the right to red if the value of the cell is less than 104 and when a value is entered to the colored cell then the color index should be none. More information in the uploaded file.

test1.xlsm‎

View 9 Replies View Related

Color Cell Based On Different Cell Value

Aug 22, 2008

I've been trying to shade a cell (A2) a certain color based on the value in another cell (B2), but I can't seem to get there with the code I've pieced together from other code snippets. I have a table of cities ("contacts200805_table") where the city cells are color coded based on which person is assigned to work in that city. People are often reassigned to different cities, so I'm trying to create a macro that will update the cell color for me.

I use a different software to generate the list of people and their assigned cities. I copy the list into a table ("input_contacts"). The city info populates A2:A1043. The person's name populates B2:B1043. "Input_contacts" and "contacts200805" have the exact same cities and always will. The people will change. I use the "input contacts" table to just dump the new list. The "contacts200805" table is what I use for the report, so the format can't be changed. Here is what I want my macro to do:
start macro

select the "input contacts" table
copy the people in range B2:B118
select the "contacts200805" table
paste the people in B2:B118 which is next to the city column (A2:A118)
repeat for other columns

look at the name in cell B2 on the "contacts200805" table
if name = jane doe then color the city cell (A2) red
if name= john hanson then color city cell green, etc. (I have 6 people to compare)
repeat check for all cells that contain a persons name (columns B, D, F, H, J, L, N, P & R).................

View 5 Replies View Related

How To Validate If Left Cell Value And Left Cell Above Value Are Not Same

Sep 16, 2013

I have a column that is giving unwanted value . dont know the reason as that excel file has been created by some other guy and I just started working on it .

My Question is how to move to 2 cells left(A for example) from from that unwanted value column. and check if
A is equal to cell above it , means B Cell(Row above A but same column).

As my excel file is totally based on Forms, Macros, I am not quite familiar with macros.

Is there any way to put if condition in one cell (column) and drag it all the way down which should work for all the values in these 3 column.

And also if A=B then I want to make that unwanted value cell="".

View 1 Replies View Related

Turn Row Color Based On Cell Value?

Dec 23, 2013

how do I turn a row range a different color based on an answer in a cell value for example:

If B4 = Wont have
Turn grey the range C4:G4

View 3 Replies View Related







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