Conditional Formatting not enough - excel

I'm trying to set conditional formatting in a specific group of cells J9:N12 with a locked cell I9 (110). In Cells J9:N12 I need the conditional formatting to set 1,2,7,8,13,14 as Black Fill w/ White Text, 3,4,9,10,15,16 as Red Fill w/ Black Text, 5,6,11,12,17,18 as Blue Fill w/ White Text. Then if I Change (I9) to 277 the Fills would change to reflect Brown/Orange/Yellow in place of the Black/Red/Blue.
Yes, I can Conditional Format the cells I need based on the information set in cell (I9) 110 or 277.
The series of numbers I need to format is greater than 120. I cannot set Conditional Formatting for each specific number needed. Minimallistically I need to be able to set Conditional Formatting to around 150-160 numbers.
I don't know if I need to utilize VBA or if Conditional Formatting is the way to go.

You could use conditional formatting for this. I'd be tempted to put the number series in an array and test for a find in the array using MATCH. This way, you'd only need as many conditional formatting rules as there are number series.
I'm not certain, but I believe you can't write an array directly into a conditional format rule, but you could refer to it from something like a range name. In any event, a range name would be easier to manage if you needed to change any of the number series.
For example, in the black/brown case, you could create a range name (Formulas->Define Name), called black-brown, and in the Refers To window, have the formula:
={1,2,7,8,13,14}
Then your conditional formatting rule would be something like:
=AND($I$9=110,NOT(ISNA(MATCH(B2,black_brown,0))))
Note my cell to be tested is in B2 - change that to whatever you need.
You'd just add rules for each of your number series cases, as shown below:

Related

Excel - border around cells with same values (conditional foratting)

Is it possible to create a border around cells that have the same value in column B like in the picture below (using conditional formatting)? Or would this have to be done using VBA?
You sure can using multiple conditional formatting rules.
In your example it's very easy to manually just add the outside borders (assuming this range won't change).
Then select the range B2:D14 and add a conditional formatting rule through formula:
=COUNTIF($B$2:$B2,$B2)=1
Make sure to apply the top border formatting and press OK.
That's it...
If you want your range to change you can use the following three conditions:
(note that for this to work, the first row needs to either be blank or be a header)

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.

Coniditional formatting of groups in same column based on variables

i have this Table:
and i need to format the column named "cumulative" based on a row that contains a match formula which gives the following results: 4, 10, 17, 24
so as you can see i have highlighted the groups 1-4 and 5-10 and 11-17 and 18-24 manually, but i need to automate this process if possible.
so when any variable is changed the formatting is changed as well.
From reading your question it seems as that your variable that you are wanting to group by is in another cell but jsut isn't displayed in your example above. If that is the case then under conditional formatting you can go to create a new rule and Use a formulato determine which cells to format from there you can use the numbers that are in your variable cells to color code your column.
So for instance if your variable is in cell A1, in the conditional formatting formula you could have it format that cell for anything that is equal to or less than A1. You could use the format cells based on values but it only goes to a 3 color code and it appears that youa re wanting to go further than just three colors from your example. You would have to create a rule for each of your formatting variables so if you want to have 5 different colors, then you would need five different rules. Also if you are going to use a less than or equal too, remember to check the box on the right hand side of the rules manager that says stop if true, that way the formatting isnt trying to utilize all the rules

Resources