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
Related
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.
Suppose I want to color scale complete rows on the basis of values in a column (using excel inbuilt color scale option in the conditional formatting menu). How do I achieve this? Please see the following image
I found a property Range.DisplayFormat.Interior.Color in this post, at Mrexcel. Using this property I was able to get color of conditionally format cell and use it for the other rows. Catch is, it works only excel 2010 onwards. I have excel 2010 so it worked for me.
Here is the exact code -
For i = rowStart To rowEnd
For j = columnStart To columnEnd
Cells(i, j).Interior.Color = Cells(i, 4).DisplayFormat.Interior.Color
Next
Next
If I understood you correctly I have been battling with the same issue. That is to format entire rows based on the values in one column, wherein the values have been formatted via Excel's Color Scales.
I found this truly ridiculously easy workaround that involves copying your color scaled cells into word, then back into excel after which you can delete the values and substitute them with whatever values you want without changing the format:
https://superuser.com/questions/973921/copy-conditional-formatting-3-color-scheme-to-another-tab/973974#973974?newreg=fc5ca6d04a5a406fa39cd4796b6a539e
All credit to user Raystafarian
You don't need VBA to do this, really.
But there are two things to point out from the start:
You won't be able to achieve your desired behavior with a single conditional formatting rule; you'll have to have a separate rule for each sales-based row color definition.
I have found that it is much easier to achieve desired Conditional Formatting behavior in Excel using Named Ranges for the rules instead of regular formulas.
If you're still on board with me after that preamble, follow these steps to create your named range and then create your conditional formatting rules.
First, select the first sales cell on your sheet (uppermost row)
Next, give the cell a name, "SALES". Do this by pressing Ctl+F3, or select Formulas->Name Manager from the ribbon. Then select New... In Name: enter SALES and in Refers to: enter =$XN where X is the column of the first sales cell, and N is the row number. Hit Enter.
Now select the entire cell range you wish to exhibit this behavior
Select Home->Conditional Formatting->New Rule...
Select Use a Formula to Determine Which Cells to Formatand enter =SALES=number where number is the sales number you wish to trigger a color
Select Format and the Fill tab. Now you need to decide what background color you want for the sales number you chose. You can also choose other formatting options, like the font color, etc.
Hit OK, OK, OK. Repeat steps 3 to 6 for each different sales figure/color combination you want. If you want a color for "all sales less than X", in your rule you will enter =SALES<number (< is "less than"; you can also do <=, which is "less than OR equal to"). If want the rule to happen when between two numbers, you can do =AND(SALES<=CEILING, SALES>=FLOOR), where ceiling and floor are the upper and lower bounds. If you want a color for "all sales greater than X", you can do =SALES>number.
EDIT:
To make entering your conditional formulas a bit easier, you can use the "Stop If True" feature. Go to Home->Conditional Formatting->Manage Rules, and in the dropdown menu choose This Worksheet. Now you will see a list of all the rules that apply to your sheet, and there will be a "Stop If True" checkbox to the right of each rule.
For each row color rule, put a check in the "Stop If True" checkbox. Now your formulas can be like this (just for example):
=Sales>25 for the green rule
=Sales>10 for the yellow rule
=Sales>0 for the Red rule
Etc, instead of like this:
=AND(Sales>0,Sales<=10) for the Red rule
=AND(Sales>10,Sales<=25) for the yellow rule
=Sales>25 for the green rule
The Stop If True box means that once a formatting rule has been applied to a cell, that cell will not be formatted again based on any other rules that apply to it. Note this means that the order of the rules DOES MATTER when using Stop If True.
You can do this with the standard conditional formatting menu, no need for VBA. You choose the option of specifying your own formula, and you can refer to a cell (lock the column with the '$') other than the one you want to highlight.
Background Reading
I think I have found a solution for this. I can achieve a colour scale of 5 degrees for any range of numbers across all cells in the row with the option of only affecting cells containing data.
This is achieved by creating 5 conditional formatting rules based around the following:
=AND(D4<>"",$D4<>"",($D4-(MIN($D$4:$D$20)-1))/(MAX($D$4:$D$20)-(MIN($D$4:$D$20)-1))*5<=2)
The first argument in the AND function D4<>"" is used if you only want cells containing data to be affected, remove this if you want the whole row of data colour coded.
The second argument, $D4<>"" points to the cell in the row that contains the value to evaluate - remember the $ to lock the column
The third argument, $D4-(MIN($D$4:$D$20)-1))/(MAX($D$4:$D$20)-(MIN($D$4:$D$20)-1))*5<=2 evaluates the position of the value within the entire range of values and converts this into a number between 1 and 5, changing the *5 at the end of this argument allows you to have more steps in your colour sequence. You will need to add more conditional rules accordingly. The <=2 indicates this is the second colour step in the sequence.
Colours 3 and 4 use the same condition but the <=2 is changed to <=3 and <=4 respectively.
The first and last colour stop need a small modification if you always want the lowest number in the range to be the first colour stop and the highest number in the range to be the highest number stop.
For the minimum number in the range, adapt as follows:
=AND(D4<>"",$D4<>"",OR($D4=MIN($D$4:$D$20),($D4-(MIN($D$4:$D$20)-1))/(MAX($D$4:$D$20)-(MIN($D$4:$D$20)-1))*5<=1))
the introduction of OR($D4=MIN($D$4:$D$20) catches the first number in the range
Similarly
=AND(D4<>"",$D4<>"",OR($D4=MAX($D$4:$D$20),($D4-(MIN($D$4:$D$20)-1))/(MAX($D$4:$D$20)-(MIN($D$4:$D$20)-1))*5<=5))
Using OR($D4=MAX($D$4:$D$20) catches the maximum number in the range
Note that Stop if True must be ticked for all conditions and the conditions must be sorted from minimum to maximum steps in the sequence.
Image of Conditional Formatting Rules Manager
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:
Creating a spreadsheet that has a bunch of test cases and at the end says pass or fail.
all values right now are either "Pass" or "fail". I need to be able to have a conditional where I can type in like a number. if it is above 5 i need it to return a pass. if it is below 5 i need it to return a false. any solutions guys?
The following might be the way to go:
where you enter a value in B1, which is then used to condition on. It's usually easier and more transparent to have a column that contains the conditioned value that is separate from the original data.
Another option might be conditional formatting. In this case, you condition on the value in a cell. Here I've formatted the cells to display a green/yellow/red dot (traffic sign) depending on the value in the cell.:
with the output resembling
Another option is to change the formatting of the cell to a specific "Custom" formatting:
Read more about how to Create a custom number format on Microsoft's help page.
A final option (that is a bit more intricate) requires you to set multiple, mutually exclusive, conditional formatting of the cells as well as separate "Custom" cell formatting:
Note that the cell entry A4 has a value of 16, while the display is actually "Pass" (since it's greater than 8 (cell B1). The steps for obtaining this include:
Create a conditional formatting using the "Use a formula to determine which cells to format" option.
Specify the "Format values where this formula is true" as depicted above (removing the dollar signs inserted around A4 by default), while setting the format using "Custom":
Do the same for the other (mutually exclusive) condition by creating a new rule for the same cell ("Format values where this formula is true:" =A4<=$B$1 and setting the "Custom" format to "Fail").
Once both conditional formatting rules are set, change the "Applied to" field to fit your range:
=IF(A2>5,"Pass","Fail") Replacing A2 with the appropriate cell reference.
lets say I have a xls sheet with just one column which has the following content:
1
2
3
3
4
5
5
6
You see there are some cells with equal content.
Now I want Excel to format (e.g. background) all cells which are there twice.
I would say that conditional formatting is the right way but there I always have to enter a certain cell.
Is there any possibility to do this?
Best,
Elias
I do this routinely. Start at the second cell and select the rest. Choose Conditional Formatting, as you thought, select VALUE IS EQUAL TO, and click the cell above (let's call it A1). Here's the trick: it will enter this as an absolute reference - $A$1 - but you need to strip out the dollar signs, so it is relative. Now (of course) assign a background color, or whatever style you want, and the first cell in any sequence of identical values will have normal formatting, but subsequent cells will have the style you choose.
This isn't exactly what you've asked for - the first 3, for instance, will still have normal formatting - and I'm not sure I know a way to get all the duplicated cells, including the first, styled differently. But it's a start...
Select A1:A8 and enter this conditional format - Formula Is
=COUNTIF($A:$A,A1)>1
and set a format. It will format anything in column that appears more than 1 time.