Excel Conditional Formatting and dragging to neighbouring cells - excel

I have a condition set up =IF(C2<42,C4="") the background color will turn red if met.
When dragging the crosshair (at the bottom left of the cell) to neighbouring cells, the formula stays the same.
I need the formula to then change to =IF(D2<42,D4="") and so on 300+ times, Is there any way to refer to the current column i.e =IF(thiscolumn-row2 < 42, thiscolum-row4 = "")

Excel sometimes by default puts dollar signs in front of the cell/row labels
(ie $C$4 instead of C4 .... the dollar signs tell excel not to change the formula with each row but to lock in the original values. Does your rule in conditional formatting show dollar signs? That may be your problem. Get rid of the dollar signs and what you need should work.

You don't use If in Conditional Formatting formulas. The formula itself defines the condition that you are looking for, so the if is already implied. So your formula should simply be something like:
=C2<42
I'm confused about the 2nd part of your formula, C4="". Is that supposed to be a 2nd condition? If so, use an AND statement:
=AND(C2<42,C4="")
If you are using Excel 2007 or 2010 another source of potential confusion is that references don't change in the Conditional Formatting formula box when you drag them around, even if they are relative.

Assuming you want to apply formatting to the range c1:d300, select that range of cells, bring up the conditional formatting box and enter:
=AND(C2<42,C4="")
Now it will apply the formatting with relative references to the full selected range.

Related

how do I compare each row of two different columns and highlight the highest value (not formula) in each row?

I have two columns to compare. All cell values come from the ROUNDUP function. =ROUNDUP(C6/D12,0) etc.
I want the larger, or equal, of the two in each row to be green and the smaller red. Using the formula, it does not work as expected. If I do the same with numbers typed, not the formula, it works. It appears the formatting applies to the formula and not the value.
That is the first half of the problem. I also want to autofill/paint the conditional formatting to numerous cells, but it always compares to the top left cell, rather than the two cells on the same row.
If I use the color scales formatting it works, but I do not want the scales, just red/green.
It seems hard to believe that what I want to do is not possible. Can someone please help me with this. Thanks in advance.
In conditional formatting, under 'use a formula to determine which cells to format', you need to enter
=A2=MAX($A2,$B2)
to highlight the larger cell and (as a separate rule)
=A2=MIN($A2,$B2)
to highlight the smaller cell.
Note that in the case where both cells have the same value, they will both be either coloured red or green depending on the precedence of the rules. If the 'green' rule comes first,
it will look like this:
Conditional formatting is almost its own little science within Excel. It may be more useful to find youtube tutorials on the topic than depend on a text explanation here. But the central theme is this.
You will use location locking (the dollar sign or F4) in front of the letters so that any cell to which the format is applied knows you specifically mean columns E and F, for instance.
Example: Assume your first row goes from A5 to M5, and the condition values are in E5 and F5.
I find it easiest to format one row with the rules I want, test them, and then use the format painter or copy -> paste format along with careful use of $ locking.
Drag over and select the entire row of cells A5:M5
Conditional Formatting -> New Rule -> Use a formula to determine which cells to format
In the formula field enter =$E5>$F5. Excel gets weird and often inserts double quotes. If you save the rule and go back in, it may say ="$E5>$F5" and if so delete the double quotes.
Click Format and create the cell format you want.
With A5:M5 still selected, add another rule and format for ="$E5<$F5"
The $ sign works the same way as it does in a formula. All of the columns get their format based on columns E and F, but all of the rows base their formula on the E and F values in that same row.

Conditional formatting multiple rules to single cell

I have used one formula to change the font colour if a cell contains the text "complete" & another formula to add a light blue fill to the entire row if the word "odd" appears in a cell which is in a different column to the first formula.
The conditions seem to clash & although I have changed and played with the order of the conditions & checked there is no conflict in the fill/background or the font colour, even when changing the font colour manually again the fill from the second formula returns the font the cell to black although it is set to automatic in the conditional formatting rule with the fill ?
I wonder where i am going wrong as everything suggests the two conditions should work fine together though when the fill is applied the font goes back to black when it should be green ?
Have you any suggestions ?
I found the issue, I needed to press clear on the font section of the formatting on the fill condition and then clear on the fill. Basically as a rule I press clear on anything not required in that condition and this seems to avoid the conflict and run upto 6 rules on the same cell with no problems!
You can combine multiple conditional formats overlapping cells/rows. (Excel's just a little picky that you do it just right!)
Always use New Rule as opposed to using the built-in rules.
Choose Use a formula to determine which cells to format.
For your example question, I populated the cells as shown above. Select cell B4 and set the conditional formatting as above =($B4="complete") . Note that I removed a $ (dynamic vs absolute cell reference) that was automatically filled in, so that I can fill the formatting's formula down.
Highlight entire Row 4 and set the conditional formatting as below. Again, note the modified $.
When it's working properly, copy entire Row 4, select the rows to which the formatting should be applied, and Paste Formatting.
[
Obviously the steps will vary for you depending on your data and what's in the neighboring cells whose formats you may or may not want affected by the formatting and copy/pasting.
Let me know if that works for you.
From my experience with conditional formatting, I believe that it applies a format to the entire cell rather than individually modifying fill or font colour, so formats will not combine. I had a similar situation and solved it by creating an additional rule. In your case, one that applies your desired font colour and background fill to the 'complete' cell if the same row also contains 'odd' using the AND() function.

Apply Conditional Formatting to Range but Only Format Cell Where Condition Is True

I have a sheet that looks like this:
The coloured cells need to be a specific colour based on their value. I am currently using conditional formatting to achieve this, but I am only able to get it to apply to a single column instead of the entire range A:G. For example, here’s my formula for column A for values that should be coloured light blue:
=OR($A1="CA515",$A1="CA525")
And applies to:
=$A:$A
Using the above formula, if any of the cells in column A contain the value CA515 or CA525, the cell alone is coloured light blue. Is there any way to use a single conditional formatting formula to make it possible that if any of the cells in the range A:G contain the value CA515 or CA525 that only that cell alone is coloured light blue? Or do I have to apply the formula to every column individually, or possibly even resort to VBA?
Thank you in advance!
You can avoid using VBA here*... Remove the dollar signs in your conditional statement, it should be
=OR(A1="CA515", A1="CA525")
The dollar signs specify whether the reference is relative or absolute. To visualise how this works, try typing these formulas into a cell and dragging the corner of the cell down to autofill:
=A1 'Autofilling this down will give =A2, =A3, ...
=$A1 'Autofilling this down will give =$A1, =$A1, ...
So by removing $, your format condition should be spread across the range. To set the range, change "applies to" to $A:$G.
Note: many conditional formats over a large range like this could severely impact the speed of your document. Consider at least limiting the number of different formats, or the number of rows it's checking.
*Although the above method does avoid VBA, it might be quicker to write your own formatting routine in VBA, since it wouldn't have to get checked so frequently and it would be unaffected by moving around of ranges which messes with conditional formats.

Excel Formula If Cell Contains String

I'm currently working in excel, and I'm trying to figure out a way to find if multiple cells contain the string value of another cell, and if it does highlight the cell where the row and column meet up. I created an example of what I want, only it will be on a much larger scale.
I've tried using: =ISNUMBER(SEARCH(substring,text)) but I'm not quite sure how to use it the way I want to.
Any help will be appreciated!
Your approach is correct, we can use the fact that conditional formatting is applied like dragging a formula, adapting relative references.
Create a conditional formatting formula rule:
=ISNUMBER(SEARCH(B$1,$A2))
Applied to B2:D7
Your formula will work nicely; what you'll want to do is put that formula into all the cells you want to highlight, so you get FALSE and TRUE in every cell.
You'll then use two Conditional Formatting rules. The first will look for Cell Value = TRUE, and will set cell background and font colour to yellow. The second will look for Cell Value = FALSE, and will set cell background to No Colour and Font to White.
This will reproduce the result you're looking for.
Edited to add:
It is possible to do this using just Conditional Formatting too, but it's a little more fiddly. If you want to try it, you can do this:
Highlight your range, and take note of which cell is Active - that's the cell within your highlighted range that is still white. It's also the one whose address is shown in the Name box in the upper left. For the sake of this answer, we'll assume that's B2
Create a new Conditional Formatting rule. Choose "Use a formula to determine which cells to format".
Use the formula =ISNUMBER(SEARCH(B$1,$A2). Set the format to colour just the cell background.
Note where the $ appears in the formula above - you want to leave the row number anchored in the first part, and the column letter anchored in the second part.
This takes advantage of the fact that Conditional Formatting is able to use absolute, relative, and mixed references to find which cells to format. It's also a tidier solution, but it can be harder to maintain if the sheet is ever repurposed or modified.

Copying conditional Formatting in Excel

I use conditional formatting to format a cell depending on the values of another cell. This is the rule:
Cell Value not between =$BV$10*0,5 and =$BV$10*0,5
This rule is saved on Cell Y10
(Explanation: If the Value in Y10 is inbetween 0,5...1,5 * BV10 apply the formatting)
I want to use this rule on many different Cells but the formula should adjust automaticly, just like in a "normal" formula.
When I copy the format using the Format Painter the formula is copied without any changes. But I need the row to be changed. For example, when copying to Y11 the formula should be changed to :
=$BV$11*0,5
Is there any way to achieve this or to change $BV$10 into $[this column+83]$[this row] or something like that?
Yes. $ is used to lock the cell reference.
So to get what you need just change your formula to this unlocking the rows:
=$BV10*0,5 and =$BV10*1 ~~> I change the limits to actually test the formula
So if you want your column to move as well, then remove the other $ sign.
Also, you can explicitly apply this formatting to other cells by supplying the range in Applies To argument like below:
Take note that you can actually put the formatting in any cell.
But the effect will always be on the Range you explicitly define in Applies to.
I discourage using the Copy Paste Format as this sometimes overlaps formattings you've done.
To apply the formatting to a group of different range, just separate the ranges with a , comma like what you see below:
So the formatting will then be applied to $Z$10:$Z$20 as well.
It is the same as $Y$10:$Z$20, but I just want to point out that it can be used to none contingous range.
And since your column is locked with your formatting, it will still be references to $BV(x) where x is the corresponding row in Y and Z.

Resources