I'm trying to apply conditional formatting in Excel on a range of cells, based on the adjacent cell's value, to achieve something like this:
The goal is to highlight values in Column B (Actual Expense) red if the value is greater than it's adjacent value in column C (Expected Expense). I've followed a number of tutorials that said to apply conditional formatting by selecting Conditional Formatting>New Rules>Use a Formula to Determine Which Cells to Format then applying a rule =$B4>$C4 which would format the 'Actual' cell red if it were greater than the 'Expected' cell. This works great for one cell, but not so well when I attempt to apply this to a range of cells. I've used the format painter as well as editing the rule to be applied over a range of cells (i.e. $B$2:$B$5) as shown below but it only bases the formatting on the initial formula (if B4 is greater than C4) and everything undesirably turns red.
I'd rather not make individual rules for every row. Is there a way to consolidate this into one rule?
You need to take out the $ signs before the row numbers in the formula....and the row number used in the formula should correspond to the first row of data, so if you are applying this to the ("applies to") range $B$2:$B$5 it must be this formula
=$B2>$C2
by using that "relative" version rather than your "absolute" one Excel (implicitly) adjusts the formula for each row in the range, as if you were copying the formula down
I don't know if maybe it's a difference in Excel version but this question is 6 years old and the accepted answer didn't help me so this is what I figured out:
Under Conditional Formatting > Manage Rules:
Make a new rule with "Use a formula to determine which cells to format"
Make your rule, but put a dollar sign only in front of the letter: $A2<$B2
Under "Applies to", Manually select the second column (It would not work for me if I changed the value in the box, it just kept snapping back to what was already there), so it looks like $B$2:$B$100 (assuming you have 100 rows)
This worked for me in Excel 2016.
Related
I have two columns. 1st column is an expected completion date (ECD). 2nd column is a actual completion date (ACD), which starts out blank. I want the ECD to turn red if its date is in the past...easy. I want the ECD to turn back to white if there is an ACD filled in.
To me the formula would be: =AND(A3:A5 < TODAY(), B3:B5 IS NOT BLANK) But that formula is not allowed.
Can someone please help?
When you setup conditional formatting you have to be very careful about how you specify things. When setting up your formulas you only reference the 1st row of your AppliesTo range, excel will adjust the references as it moves down the range. Of course this will be different if you are referencing cells that are not in your first row. If referencing constants remember to use the $ for the rows/columns that don't change.
In this specific case the formula you want is: =AND(A3<(TODAY()),B3=0,A3<>0)
I have a schedule with team member names and the column headers are half hour time intervals. I want to shade the cells of hours each person does not work with gray according to their shift schedule, so that I know not to schedule that person during that hour.
I have created a separate table with each person's shift schedule, and the names appear in the same order as in the schedule.
Is there any way to conditionally format the cells at once? There has to be an easier way then what I am doing now...which is one by one clicking on each person's cell and creating the formatting formula.
I can't copy paste the formatting because the formula still refers to the previous person's shift on the other table. I need it to refer to the next row.
The formula I use for conditional formatting is:
='Job Functions'!$O$5>$C$9
Where Job Functions is the sheet that contains the shifts, O5 is the shift assigned to that employee, and C9 is the column header on the schedule (6:30am). I just clicked on the cell and created a new conditional formatting rule from the excel ribbon on top...no vba.
If there is a VBAsolution to this that'd be great! I'm fairly new to VBA
Conditional formatting works like this
Let's say I have an array of numbers in A2:E5 and a header row in A1:E1. I want to have my array of number be green if the value of the cell is greater than it's column header. That is to say I want to compare A2>A1, B5>B1, D4>D1, etc. this means I want the header row comparison to be constant.
In Excel formulas you use the $ symbol to maintain constant references. Since I want the row to stay constant but I want the column to be relative to the cell in my array of numbers my header reference will be A$1 (column is relative, row is locked).
This is just the formula used to determine if formatting will be applied or not. If it returns true then the conditional formatting is applied, if it returns false then nothing happens.
However, where the formatting is applied is determined by the Applies to reference. In my example below I am applying the formula A$1<A2 to $A$2:$E$5. This means that in the cell A2 the formula A$1<A2 is used to determine if formatting is applied, but in B3 the formula B$1<B3 is applied. This is the same logic as if you were to have dragged the formula itself into these cells.
If instead my Applies to formula were $B$2:$E$5 this means that B2 would be colored green if A$1<A2, and B3 would be colored green if A$1<A3.
So with all that your formula should probably be
='Job Functions'!O5>C$9
drag and drop it down to fill the other cells
I am currently trying to apply conditional formatting to certain rows which contain numbers in percentage (e.g. F11 to N11; F14 to N14; F17 to N17 and so on). These are also the only rows in the worksheet that have numbers in percentage. Would like to know what the fastest way to go about doing this is.
Should I:
(i) apply conditional formatting to the whole worksheet to numbers in percentage (if possible) or
(ii) apply conditional formatting to each individual row which is extremely time-consuming?
Appreciate if anyone can help.
Thanks in advance! :)
If your data in the percentage rows is also formatted as percentage, you can use the =CELL("format",[reference]) function, that returns "P0" or "P2" for percentage formatting.
Use a helper column (which you can hide if you want) to check the formatting of the first/last cell in the row, and then set conditional formatting based on the column:
After you create the column, you set a conditional formatting rule on the the upper-left cell in the range based on the formula: =[top cell in helper column]="P0". Keep the column fixed with a $ but not the row, as in the screenshot below, so you can drag the formatting to all the range with correct reference to the helper column.
Next step is to drag this cell to all the range, choosing the "formatting only" option:
Finally, you have to format again all rows that contains percentage values to percentage formatting.
However, if the place of the percentage rows is fixed, you don't need that CELL() function, just write in the helper column something like p or 1 for the rows to format.
(I have also tried to plug the formula directly to the formatting condition, but it doesn't work well all the time)
Tell me if it solved your problem ;)
I have several columns where the data from rows 7 onwards changes depending on the selection made from a dropdown menu in row 6. Most of these options will result in textual or number based values appearing, but two of them would need to be formatted as currency.
Essentially what I want is a conditional formatting formula that says; if row six in any column has a value of “Implied Unit Rate” or “Annual budget”, format rows 7 and onwards in that column as currency.
I can get this to work by creating two separate conditional formatting formulas and applying them both to the whole area, but it seems like there should be a way to do it in a single formula.
My current formulas, applied as two separate rules:
=INDIRECT(ADDRESS(6,COLUMN(),1))="Annual Budget"
=INDIRECT(ADDRESS(6,COLUMN(),1))="Implied Unit Rate"
How I think it should work when applied as one rule:
=OR(INDIRECT(ADDRESS(6,COLUMN(),1))="Annual Budget",
INDIRECT(ADDRESS(6,COLUMN(),1))="Implied Unit Rate")
When I enter the combined formula in a regular cell within the worksheet, it does return true as expected, but does nothing when I apply it as a conditional formatting rule. Any ideas? Thanks in advance!
Now I may be mis interpreting what Scott is saying, so I am going to say this in my own words.
Your condition check on the cell address in question is a little "verbose". In order to apply your conditional formatting, select the range you want to apply your condition formatting to first. Lets arbitrarily say select range A7 to D42. After selecting the appropriate range, ensure cell A7 is the active cell of the selected range. This usually means there is a border around A7 to D42 and all cells but A7 have been slightly greyed to indicate that they have been selected, and A7 will have a brighter background to indicate that it is the active cell. With all that still in effect, select your conditional formatting.
In conditional formatting choose formula as the option (last one at the bottom) to control how your formatting will be applied. In the region where you can enter your formula, enter the following:
=OR(A$6="Annual Budget", A$6="Implied Unit Rate")
The $ will keep the row and column reference from changing as it is applied to each cell in the range. It will always be checking row 6 of what ever column the cell is in. The column A reference is relative to the active cell.
I want to do conditional formatting on the following data.
Data Image
When first column (1c) value is equal to second(2c). Paint green else paint red.
Compare:
1r1c to 1r2c
2r1c to 2r2c
3r1c to 3r2c
Currently it is comparing r1c1, r2c1 and r3c1 to r1c2.
What's your current conditional formatting rule?
edit:
OK, your current rules are =$E$2 and <>$E$2, both applies to =$D$2
You are telling MS Excel to compare cell D2 with cell E2. First you have to apply your rules over area D2:D_many (you can apply rule over both columns to get both cells colored, sometimes it's useful). Second remove $ in your rules, change rules to =E2 or =$E2 If you apply conditional formatting rule over one column (D), there will be no difference, but if you apply rule over multiple columns (for example D:H), first one will compare cell with cell in the same row but one column right, second one will compare cell with cell in the same row and column E.
Ok.
I tried to create a new rule and got the correct format. I used this formula.
And the rule created was this
Now working fine. Thanks.