Excel 2011 copy formula/rule headache - excel

I'm trying to set up a formula or rule (don't know which is the best to do this) on excel 2011. So for cell A1, I want to type in a value. I want cell B1 to show it in green if the value is more than A1 or red if it's less. 1) I also want to copy this formula or rule down column B so that it will change according to the value in column A (A1:B1, A2:B2, A3:B3, etc). If possible, I also want to copy this formula or rule to columns C, D & E so that if the value in cell C1 is greater than the value in B1, it will turn green and red if it's less, etc.
Thank you in advance.

What you need is Conditional formatting.
Steps to perform:
Click a cell
Go to menu: Format -> Conditional Formatting,
Choose formula based formatting.
Edit based on your formula
You can use the copy formatting icon to copy this conditional formatting to the whole column

Related

How do I change the color of a column based on the color of other column?

I am having trouble coloring cells in a column (if a cell D2 is light green, then B2 is colored light green).
I have tried using conditional formatting, and looked at Changing Color of a column based on other column in put
However, I do not know what to put in formula to say that a cell D2 is light green.
Let me know if I broke any rules here, and I'll fix.
Like I said many times before: Color is not data. There is no worksheet formula or conditional formatting rule that can evaluate the color of a cell.
The reason or logic for that manually applied color is in a person's head, but not derivable from data in the spreadsheet.
Use real data in the spreadsheet if you want to use conditional formatting or worksheet formulas.
If you want to evaluate cells by their color and apply that same color to another cell, you will need to use VBA.
Apart from using vba, if you can tolerate the following:
manually refresh the conditional formatting for Column B each time you change the colour in Column D
save and continue to use your workbook as .xlsm (macro enabled workbook)
then try the following:
Please note I used the following sample data (starting from the first row) where Column A serves as Column D in your question:
In the Name Manager, set up a name called GetCellColour with the following formula:
=GET.CELL(63,$A1)
Replace $A1 with $D2 or the actual cell reference in your real case. This should be cell that will trigger the conditional formatting in B2.
Set a light green colour in cell A1, and in a blank cell say C1 enter the following formula:
=GetCellColour
In my example the colour code returned by the above formula is 35 for light green.
Highlight Column B (or the relevant range in Column B that you want to apply the conditional formatting rule) with cell B1 being the active cell, go to Conditional Formatting function to set up the following formatting rule:
=GetCellColour=35
Then your cells in Column B will be highlighted by light green colour if the corresponding cell in Column A is colored in light green. Please note, if you changed the cell colour in Column A, you need to go to Data tab to Refresh the worksheet to "update" the conditional format in Column B.
Here is a live demo:
For the use of GET.CELL function in the name manager, you can give a read to this article.
Let me know if you have any questions. Cheers :)

Conditional Formatting for a row when there is a text disagreement between two cells

I'm working on a conditional formatting issue. I would like the whole row to highlight if the text in the same row in columns B and C disagree. So far, I've been able to write conditional formatting rules that leave the cell un-touched if there is no data and if there is a data entry that disagrees with the text in Column B, but I can't seem to get the formula to apply to the full row.
Here is what I currently have:screenshot of the document with conditional formatting rules visible
I'm working on Excel 2010. Maybe there is a way to use a logic formula?
I look forward to hearing suggestions!
You can do this with a formula. Highlight the range you would like to format, create a new conditional format, select "Use a formula..." and enter the formula as it would apply to the first cell or in this case row.
In my case, I chose the first 6 rows: $1:$6 as my range. So in this case, I would enter the formula as if I were only entering it for my first cell. The formula =$B1<>$C1 will check for inequality between B1 and C1 in the first row, B2 and C2 in the second row, and so on.

Conditional Formatting with Formula using Relative References

I looked around for an answer to this and found a similar thread, but it did not quite answer my question so here goes.
I have two columns, each with 262,000 rows of data. I am trying to highlight data in one of the columns based off of two conditions. I think I have the formula right for the conditional formatting, but the problem is that it will not apply to the entire column as I want it to. For example:
=AND(K6<=1638, L6=0)
That's the formula I have. I want that formatting to copy and paste all the way down column K, iterating each time. For example, the cell below should have formatting that says the following: =AND(K7=1638, L7=0) but I cannot get it to this. It just keeps looking at the values in cells K6 and L6.
Is format painter not the way to get this formatting applied to each cell?
Have you tried using conditional formatting as below?
I simplified the formula in the example but should work for your case as well.
It seems to me more practical for large ranges than Format Painter.
The formula =A2 > 4 has the cell A2 hardcoded, yet it magically works when applied to cells A6, A7, etc.. Excel uses this formula in relation to the first cell in the range, so if you wanted to highlight cells in column A that are greater than column B, and your range started in A2, your formula would be = A2 > B2.
I suggest select Column K and HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=AND(K1<=1638,L1=0)
Format..., select choice of formatting OK, OK.
When the rule is shown in the Conditional Formatting Rules Manager it is as applicable to the top left hand cell of the Applies to range. CF in effect raters through the range adjusting cell references automatically just as they adapt elsewhere (ie when going down Column K, K1 scrolls forward to K2 etc, whereas K$1 would stay as K$1).
You can do the conditional formatting you need by utilising OFFSET() and ROW() functions, so that your
=AND(K6<=1638, L6=0)
becomes something like:
=AND(OFFSET(K6,ROW()-6,0)<=1638, OFFSET(L6,ROW()-6,0)=0)
replace -6 with the row offset value you need.
So, for example, if you enter this formula into some cell in row 6, it will look into K6 and L6 respectively because ROW()-6 evaluates to 0 – so no offset is applied.
Then in row 7 the SAME formula will look into K7 and L7 because ROW()-6 evaluates to 1 which means offset one row below K6 and L6.

Conditional formatting based on reference cell value for each cell in row

I would like to color cells in each row based on the value of a cell in the same row and then do the next one.
How do you set the formula to be able to color the cell if not equal to a reference cell on the same row?
So I just want to change the color of a different cell than reference cell which will have a different value for each row.
In Excel you will need to create a formatting rule, within the modal select the option that you want to use a formula to decide what cells to format:
Within the edit box you can type the formula that is used. The formula in the example will check whether the value of the 1 cell in the column is not empty. If this is true, the cell will be formatted as specified in the format preview.
Mainly using the ROW and COLUMN functions in Excel you can get access to the current Row and Column of the Cell for which the formula is executed.
Given the input:
Select Cells B2:G6 and click on Conditional Formatting
Your prompt will look different on Windows, but the important part is "Use a formula to determine which cells to format" The formula is =B2<>$A2 Please note the lack of $ because it needs to be flexible (except for the reference cell column which in my case is A)
Final result is:
Conditional formatting foes not need to operate on the cell you are formatting. Using a mixture of $ and non-$ formatted formulas, you can set highlighting accordingly.
Note to make sure this works correctly, highlight the area to be formatted first, and note where you start. e.g. If I wanted this to apply to A2:A50, then I would highlight A2 first, and make the formula reference row 2.
Also, note that you will have to type in the formula. Any clicking of cells will automatically put in $ signs to fix the comparison to that specific location, which is not the behavior we desire
e.g. To format A2:K50, when the H value in that column is 7
Highlight A2:K50
Conditional Formatting -> New Rule -> Use a formula
formula would be =($H2=7) <- this will fix the column to be H, and vary the row accordingly
Format as desired
e.g.2. To format based on previous cell
Highlight A2:A50
Conditional Formatting -> New Rule -> Use a formula
formula would be =(A2<>A1) <- this will check the row above each time
Format as desired

Excel Conditional Formatting Self Reference

I'm trying to do some conditional formatting in Excel 2003, what I want to do is have a cell go red if the next cell is "Yes" and go bold if it, itself, contains "Yes". So if both cells are "Yes" the current cell will be red and bold. I want to do this for a group of cells so I haven't used a direct reference to the cell, but I have come up with the following.
=AND(INDIRECT(ADDRESS(ROW(),COLUMN()))="Yes",INDIRECT(ADDRESS(ROW(),COLUMN()+1))="Yes")
But this always fails. However, if I use either on its own (INDIRECT(ADDRESS(ROW(),COLUMN()))="Yes" to make the current sell go bold), it works.
Does anyone know how I can self reference a cell generically in excel 2003 conditional formatting?
I don't have Excel 2003 to test on, only 2007. However, I think you can solve your problem with the following rules. Assume that your first column is A and the second is B with the first data value in A1.
First rule on A1 is highlight using a formula of =and(A1="Yes",B1="Yes") and the format is bold text and red background.
Second rule on A1 is highlight using a formula of =B1="Yes" and the format is red background only.
Third rule on A1 is highlight when cell equals "Yes" and the format is bold text only.
Then copy this format to all the other cells in column A with the format painter. Excel will automatically adjust the cell references for you so that in A2 the formula refers to B2, in A3 it will refer to B3, etc. Note that the order of the rules is important because Excel 2003 will stop after the first rule that matches. That's why you can't get the behaviour you want with only two rules.
You can also copy the same format to column B, assuming that's what you want. Otherwise, format B1 with the rule to bold when cell equals "Yes" and copy that to the rest of column B.

Resources