IF-Condition coloring cell - excel

I'd like to compare 2 cells (A1 and A2 - both formatted hh:mm) and color one cell, A3, depending on the result of the comparison of A1 and A2.
A1: Hours per day to work: 8
A2: Hours worked: 8
Pseudo Statement
IF (
A1 = A2,
"",
IF (
A1 > A2,
COLOR_CELL( A3 ),
IF (
A1 < A2,
COLOR_CELL( A3 )
)
)
)
I researched but I only found that you can use conditional formatting. This doesn't seem to help me ... is this possible?

You wrote that you could not use conditional formatting because I can't multiple events on one cell using conditional formatting. Note in the screenshot that we have multiple rules applying to cell A3, which is colored according to those rules:

Conditional Formatting is exactly the thing you're looking for to do this, outside of that you can use VBA to change the colour of the cells, but that's really long and clunky and needs to be set away unlike conditional formatting which works on the fly
There's no 'only in cell' function that can change the colour of the cell
I know you said no conditional formatting but it really is the thing you want to use, and it works across excel, google sheets and other things
Highlight area you want to use
Home -> Conditional Formatting -> Create new rule
Use a formula to determine which cells to format
=$H9<$I9 note that this is an example, you want the $H to be the row that the allocated time is, the $I to be the actual time, and then both 9s are replaced by the top row that you want to effect
also note that you appear to have the columns downwards so adjust accordingly to where they need to go (without seeing the sheet and how it fits together I cant give you the exact formula to use
set the format to what ever you want
click ok
select add rule
repeat process but change the < to > this time and set the formatting accordingly and click ok
Set the Applies to to the range of cells you want to have the highlight on it
click the ok
hey presto, done
Ste

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.

Excel: Conditional Format specific cells that match rule

Need help with Conditional formatting Rule
In the example below, I only want to highlight the specific cell that passes the rule - E1 > 100% So, only E3 needs to be highlighted in Red. With the current rule, it is highlighting every cell from E4 thru E13. I only want E3 to highlight because E3 passed the criteria. And similarly for other matching E cells.
I have modified the formula per "UrDearBoy" and this is how it looks now and it works!
You need to amend rule to ignore text values so change your formula to:
=AND(ISNUMBER(E1),E1>100%)
FYI - Conditional formatting can be processor heavy so I would consider limiting the Applies To range to the relevant range rather running this check on all ~1MIL rows
I was able to set up a rule with these properties by using "Conditional Formatting > Highlight Cell Rules > Greater Than" and then set the value to 1 as in the below screenshots.
If you want to go with a simple formula based solution, you can use:
=N(E1)>100%
The N() function converts text to 0 and numbers to their numerical value.

Apply same format to different cell with different input

I would like to know, if possible, how can the following be done: I have two cells with different inputs that change depending on filters.
Example:
A1 = 5
A2 = 7
A1 has a dynamic format that changes depending on its value.
The value of A2 also changes, however I would like to have the same cell color and font as A1 despite not having the same number.
Copy formatting is not an option as it is static.
Apply same formatting rules does not do the work as it has different values.
Maybe a macro that copies format of A1 to A2 every time change in value happens.
thanks in advance,
Kylian
You can apply the same conditional formatting to multiple cells:
To create a new rule:
1) Highlight A1:A2
2) Add a new rule with the following formula:
$A$1=5
(I assumed 5 is the value that triggers the rule)
To expand an existing rule, go to Conditional Formatting and edit the formula so it uses absolute referencing (i.e. add $ in front of the column and row: $A$1 instead of A1, then edit the range the rule applies to:

Excel - condtional formatting based on multiple strings

I would like to fill the cells individually from C to L based on the 7 lists on the right. Unfortunately this isn't working too well.
Not every cell is getting filled and others are filled wrong/double.
I select the cells for the conditional formatting for the deep red list based on this:
=OR(ISNUMBER(SEARCH($M$2:$M$20; C2)))
I'd guess that here's a simple error in thought with the "C2"?. Thanks in advance!
Edit:
Link to the file
https://drive.google.com/open?id=1mtGdSlDCMdR1qXVU07Z-hGFyvtq21Hpb
The conditional format rule you are using applies to the range $C:$L. The first cell in this range is C1; substitute C2 in your formula with C1 and it should work as desired.

How can I colour a cell in excel based on the values in the cell next to it?

I've looked in to conditional formatting, but it doesn't manage relative references at all.
what I would like to write is something like
If ( the column number of this cell is more than the value in the first cell of this row)
colour it blue
end
It seems something really trivial, but writing something like:
=IF($C$3+4<=COLUMN();COLUMN()-4<=$D$3)
always returns true (I guess ecause it takes COLUMN as a fixed number, say the value it gets the frist time it calls it) and so all cells are blue.
that function returns the right value when evaluated inside the function field, but does not work for conditional formatting.
What can I do?
Assuming you want something like this:
Select Columns A:H and HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=COLUMN()>$A1
Format..., select choice of formatting, OK, OK.
You can do this with the normal conditional formula itself. Perform the following steps.
Click on a cell, the first cell that you wanted to color. Say it is C3
Now the default cell becomes your cell C3.
Click on Conditional formatting options, in that, select "Manage Rules"
In Conditional formatting rule manage window, click on New Rule button
In the new formatting Rule window. select Use a formula to determine which cells to format
Enter =(COLUMN(C3) > $A3) in the Format values where this formula is true edit box
Select the required color and click ok
Now copy this cells to all other cells where you want to do the conditional formatting.
Here the step 1 and 2 are critical to ensure that it is relative.
Quite hard to understand what you want without having more informations. Be that as it may, note that
=IF($C$3+4<=COLUMN();COLUMN()-4<=$D$3)
Means
if $C$3+4<=COLUMN() return COLUMN()-4<=$D$3 otherwise return FALSE
If it always returns TRUE it is because the tested cells are between the $C$3+4th and the $D$3+4th columns AND that $C$3 - $D$3 is a positive number which is sifficiently large for not beeing exceeded by the column number of the cells you test.

Resources