I have some large tables of data for percentages of employees in different areas with degrees for each month for the past year, I want to add a conditional format that highlights a cell green if the number increased from the previous month and red if it decreased. I know how to do this individually but I was wondering if there was a larger scale method to do this?
The following assumes that the data is formatted such that the percentages of employees are all in the same row and the successive months are in consecutive columns.
Here's how I have my sheet set up:
What you can do to acquire the red/green formatting is highlight C2:M2, click Conditional Formatting under the Home ribbon, then select New Rule. Next, click "Use a formula to determine which cells to format" and in the formula bar write the following:
=IF(C2 > B2, 1, 0)
Now click Format and go to the Fill tab. Select any shade of green that you want and press OK. Press OK once again on the Rule window and that "greater than" rule will be created. Do the same thing but instead enter this formula
=IF(C2 < B2, 1, 0)
and select a shade of red and you should be good to go.
A possibility you did not mention is that cells that have not changed in value from one month to the next should be neither red nor green. That is still possible with just two rules if coupled with a default fill set as ‘standard’ fill rather than with conditional formatting, say red:
Select the range to be formatted, say C2:M100, and apply a ‘standard' fill of red colour. B2 is assumed to be a datapoint but since without precedent is not to be formatted.
Overwrite this with a conditional formatting rule using a formula to determine which cells to format such as:
=C2>B2
and select green fill.
Add a second rule of:
=C2=B2
and select white fill.
Since the rules are mutually exclusive, might as well check Stop If True for both.
There is no need for =IF(…,1,0) since this is Conditional Formatting and the IF is implied.
If you wanted say a traffic light analogy, with amber for ‘no change’, use a ‘standard’ amber fill for B2:M100, select C2 and apply:
=C2>B2
as above and select green fill but change the second rule to:
=C2<B2
and select red fill.
Ensure that the Applies to range for both the above is =$C$2:$M$100 (this just being an alternative to starting by selecting C2 rather than the entire applicable range).
Related
I am trying to create a formula for Excel whereby a cell would change color based on the number in the cell.
So for example, if cell H3 of sheet 1 is 50% of cell H3 on sheet 2, I would like H3 on sheet1 to turn green, if it´s higher turn yellow until 75% and then red.
next, if cell H4 of sheet 1 is 50% of cell H4 on sheet 2, I would like H4 on sheet1 to turn green, if it´s higher turn yellow until 75% and then red.
and this until all the other cell´s just at H50!!
thank you for your help
This can be achieved without any programming. Simply using Conditional Formatting and thoughtfully ordering your rules will achieve this. This will take 3 separate rules in your logic
First, Highlight the cells you want to format and select Conditional Formatting in the Home tab of the ribbon.
Second, select New Rule and choose "Format only cells that contain" and choose "less than or equal to" (depending whether you want that, you said equal, I figured you wanted equal or less than). Then in the third box select the cell of the range in the second sheet making sure the cell reference is unlocked (no $'s) and multiply by .5
Third, same approach but now do the .75 condition, and the last one use .75 again but select "Equal to or greater than" depending how you want to treat exact .75 matches.
Lastly, when ordering the conditions, start with the lowest value threshold being the highest in the order.
I'm doing a sales sheet presentation and need to show in colours how that client did based entirely on his previous months' purchases, green for better, red for worse.
Example:
How can I do this with conditional formatting?
In the CF crete new rule, choose Use formula... in rule type and
use =C2<B2 formula for red cells and =C2>B2 for green cells.
how can one format the color of cells according to their values in that row? In this table, I want to give red for the most expensive carrier, green for the cheapest one and orange fro the middle range one, for each row:
After conditional formatting, it should look like this:
Thank you!
Apply Graded Color Scale conditional formatting, but set the Applies to range to =$B$2,$E$2:$F$2
Then use format painter to copy this conditional formatting to the rows below. You'll end up with a separate rule for each row:
Format your colors to suit.
Another way with just two rules is to 'standard' fill with orange as much of ColumnsB, E and F as required, select and clear any CF rules from B:F then HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=AND(B1=MAX($B1,$E1,$F1),B1<>"")
Format..., select red Fill, OK, OK.
Add another formula rule of:
=AND(B1=MIN($B1,$E1,$F1),B1<>"")
with green Fill.
Select ColumnD and Clear Rules from Selected Cells.
In case of ties green will have precedence, unless the rule order is reversed.
I have two Excel columns of numerical natural values and of the same length.
For each row I would like to fill the cells with red if the values are different, with green if they are equal.
I thought I could do this using Conditional Formatting but it seems it is not fit to compare two columns.
Am I wrong? How can I do that? How to use an IF statement for this?
Assuming the values are in column A and B
To create the first rule:
Select columns A an B. Do this by dragging from column header A to
B.
Then, click Home > Conditional Formatting > New Rule.
In the New Formatting Rule dialog box, click Use a formula to
determine which cells to format.
Under Format values where this formula is true, type the formula:
=$A1=$B1
Click Format.
Select a green fill color.
Click OK until the dialog boxes are closed.
The formatting is applied to column A and B.
Now you can create a second rule for =$A1<>$B1 with red fill color.
A "cheat" (if your columns are not too long) is to transpose your two columns, then use CF's Highlight Cells Duplicate Values rule (but change the default colours to suit) and transpose back again. It may be a slight advantage of this transposition that formatting will not be applied to cells in the same row that are both blank (though easy enough to arrange for this with a formula rule).
The point of my answering however is really to say that you only need one rule. Since every cell is going to be either red or green using standard formatting for one format is sufficient. For example, fill your entire data set with 'standard' green fill and then apply a formula rule for red. This will happily override the 'standard' green fill where appropriate.
If applied to Range $A:$B (such as by first selecting ColumnsA:B) I suggest a formula rule of:
=AND(A1<>"",$A1=$B1)
You do not need an IF statement because the formatting is conditional (the IF is implicit).
Assuming your data is in columns A and B, first select the column you want to colorize.
Then for the green :
Conditionnal Formatting > New Rule > Use Formula to determine... > type formula : =(A1=B2)
Then Click the Format... button and choose Green color
And for the red :
Conditionnal Formatting > New Rule > Use Formula to determine... > type formula : =(A1<>B2)
Then Click the Format... button and choose Red color
I have two columns. One column has the tier as Prime,essential,maintenance and Consumption.
Other column has values in either % or as NA.
I want to format all cells which are having tier as Prime and essential and value is >=90 as green else Red.
Similarly if tier is maintenance or Consumption and value is >= 96 then green else Red .
How do i do it.
Please help
Select the range that you will work with;
Click the Home > Conditional Formatting > New Rule….
In the Format Only Cells with section, specify the conditions that you need.
Click the Format button.
In the Format Cells dialog box, set the background color under Fill tab.
More details here
For your conditional formatting just select a column go to:
conditional formatting>highlight cells rules>less than at the value you put 90 and at highlight you choose red
then again:
conditional formatting>highlight cells rules>greater than and at the value you put 89 and at color green
UPDATE:
For more conditions go to new rule and choose use a formula. The formula will look like this for the green color: =AND(A1="Prime",B1>90) then you do the same steps for the other conditions and colors.
As I understand it, all cells will be one or other colour, which means only one colour need be set by Conditional Formatting. (The other can be applied with 'standard' fill, leaving the CF rule to override it where applicable).
It might be easier to fill 'standard' with green and use CF for red but the formula rule for green (ie formatting the whole range red with standard fill) might be:
=OR(AND(OR($A1="Prime",$A1="essential"),$B1>=0.9,NOT(ISTEXT($B1))),AND(OR($A1="maintenance",$A1="Consumption"),$B1>=0.96,NOT(ISTEXT($B1))))
This assumes the tiers are in ColumnA and the percentages are in ColumnB (where the value 1 represents 100%, even if formatted to appear as 100%). The Applies to range should be =$A:$B or a number of rows in those columns, to suit. The Applies to range may be set by selecting ColumnsA:B before entering the CF formula rule.