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)
Related
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:
I have a table of repeated values and I want to add some conditional formatting so repeated values are dehighligthed and value changes are highlighted through alternative values, such as this:
How can I manage this without VBA?
I managed this through a combination of 2 conditional formats:
First, a conditional value for alternating background colors, which applies to cells where this formula is true (note that there is a circular reference at the end of the second line that makes it not work inside a cell, but it works without issues in the conditional format formula):
=LET(allaboveandme;OFFSET(INDIRECT(ADDRESS(1;COLUMN()));0;0;ROW();1);
indexeswithme;MATCH(allaboveandme;allaboveandme;0);
distinctwithme;SUM(IF(FREQUENCY(indexeswithme;indexeswithme)>0;1));
ISODD(distinctwithme))
This will paint alternating distinct values the way you instruct.
I also added another conditional formatting to add an upper border where values change, like so:
=NOT(INDIRECT(ADDRESS(ROW()-1;COLUMN()))=INDIRECT(ADDRESS(ROW();COLUMN())))
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.
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.
I have a Excel 2010 Sheet which contains some values.
I want to achieve the following in a specific Cell:
If the User changes the Value more than 50% make it red, more than 25% make it yellow, below make it green.
I tried achieving this with conditional formatting (3-color-scale) using a copy of that value that cannot be changed as a reference using the following formula for the red paint:
=ABS(Y10-BV10)/(BV10)>0,5
(where Y10 is the value that can be changed and BV10 contains the same value as a reference)
When trying to do this I receive the Error:
You cannot use relative references in Conditional Formatting criteria
for color scales, data bars and icon sets
Any other way to achieve this?
(I create the file myself by OpenXML and so could use fixed values in the formula instead but that seems to be a very dirty solution as this formatting should work for a few hundred cells)
Rather than using a colour bar, do the formatting manually using the formula you have used to change the colour. You'll just need to have 2 formats in order. The first saying if > 50%, the next being greater than 25%
In a new conditional formatting rule, go to Use a formula to determine which cells to format option - http://office.microsoft.com/en-gb/excel-help/use-a-formula-to-apply-conditional-formatting-HA102809768.aspx
you will need separate formula for each color though - to achieve the desired effect, make sure the rules are either mutually exclusive or else in correct order (in Manage Rules... dialog - the most general rule should be on top if you don't check "Stop if True", but if you check those checkboxes then the most specific rule should be on top)