Conditionally Formatting a cell, based on cells including formulas - excel

I'm trying to highlight a cell A6, if B6 + C6 >74.9%. However, B6 and C6 are calculated values and conditional formatting reads the formula in the cell, not the value it calculates
I can create an if statement with a 1 or a 0:
=if((B6+C6) > 0.749, 1,0)
but if I use the same if statement in the conditional formatting (with out the ,1,0) nothing happens:
=if(b6+C6) > 0.749
I want the cell to turn green, rather than a 1 or a 0.

The syntax of the formula you're using is wrong. In the conditional format formula you don't need an IF statement at all, you can just write out the condition, which evaluates to either TRUE or FALSE.
In this case it's
=B6+C6>0.749
For completion's sake: if you wanted to write a full IF statement, then it would have to look like
=if(B6+C6>0.749,true, false)

Related

how to write an if statement code to compare two cell's value in one sheet to another cell in another sheet

i have two columns (Start Date, End Date) and i want a code that changes the color of both their cells to red if the start date and end date contained any date located in another sheet
I tried using conditional formatting using this rule: =AND(C2<=Holidays!$A$2:$A$15,D2>=Holidays!$A$2:$A$15)
Tested out the below formula for myself and think it should work! Effectively rather than a simple AND statement, since we're comparing against an array of values rather than single cells, we need to use some handy array formulas. This post gives a good breakdown of what's going on under the hood: https://exceljet.net/formula/index-and-match-with-multiple-criteria
Apply this formula in conditional formatting, assuming the range you're formatting starts at C2.
=SUM((Holidays!$A$2:$A$15>$C2)*(Holidays!$A$2:$A$15<$D2)) > 0
Also, wanted to call out the absolute references specified for columns. I've specified **$**C2 and **$**D2 in my formula, which means that no matter which cell in your conditional formatted range it'll evaluate off the values in column C and D. In your current formula, cell C2, would evaluate on C2 and D2, but cell D2 would then evaluate off D2 and E2. This'd be why when you tried the manual formatting only the start date cells (column C) were formatting correctly.
Hope this helps!
Update::
If you had a table format like in the attached screenshot, you would apply the conditional formatting formula:
=SUM((Holidays!$A$2:$A$15>$C2)*(Holidays!$A$2:$A$15< $D2)) > 0
To cell range $C$2 : $D$3
If you're changing the cell range (say you wanted to apply to $C$10 : $D$14), you'd just change the $C2 and $D2 in the formula --> $C10 and $D10.

How to conditional format with dynamic references

I want to highlight all the cells containing a formula error or formulas
followed the below steps
Did a CTRL+A and selected all the cells
Home > Conditional Formatting > Use a formula to determine which cells to format
Applied the formula =OR(ISERROR(A1),ISFORMULA(A1))
Selected a fill colour and clicked on ok
Expectation: All the cells which is having a formula or error value like #N/A need to be selected.
Please let me know what i am doing wrong here
Formulas in conditional formatting work with reference to the active cell in the selection. In the example given below I have selected B2 to E6 with the active cell as C3 and then applied the conditional formatting.
In the example above in the selection B1 to E6 the active cell is C3. Now when you use =ISERROR(D4), it is effectively applying it to R[-1]C[-1] because you are checking the value in D4 according to the formula and applying it on the selected cell i.e. C3 as you can see in the image.
Thus if you now put #N/A in Cell D4, Cell C3 will become Orange
If instead the active cell in the selection was D4 instead of C3 then the conditional formatting would highlight all #N/A
If you want to understand clearly, try =ISERROR($D$4) and put a #N/A in D4, that will highlight all the cells B2:E6.
Else you can also go to
File>Options>Formulas and check R1C1 reference style

Condition Formatting not Working in Google Spreadsheet

I have written a formula:
=IF(len(d2)>0,IF(d2=0,true,false),IF(len(e2)>0,IF(e2=0,true,false),false))
I want to strike through entire row if the formula returns true. But it is not working. Annoying facts are:
If I place this formula into a cell, it shows correct true or false value.
If I apply this formula on entire row, only A2 and B2 cells are formatted.
To test whether there is come conflict with other formatting rules, I just removed the formula, and just wrote "true" in the custom formula column. And the entire row was formatted. I pasted formula into a cell and it was also returning true. How does the fomula which is returning true in the cell is returning false in conditional formatting?
I applied the formula to cells which have no other conditional formatting rules. The formula didn't work. So how the formula was working for A2 and B2 cells?
I tried using values other than true/false. As usually, it worked perfectly in cell, but not in conditional formatting.
It is not working even on fresh spreadsheet.
Please check it yourself. To get "True" value from the formula, enter 0 in d2 and e2 and see yourself that conditional formatting is not respecting it.
Thanks in advance for giving time to read the question.
The reason that the formula is only working for cells A2 and B2 is because D2 and E2 in the formula are relative references, which means that these cells in the formula shift as the cell which is applying the conditional formatting also shifts.
In other words, cell A2 considers this as the formula:
=IF(LEN(D2)>0,IF(D2=0,TRUE,FALSE),IF(LEN(E2)>0,IF(E2=0,TRUE,FALSE),FALSE))
And cell B2 considers this as the formula:
=IF(LEN(E2)>0,IF(E2=0,TRUE,FALSE),IF(LEN(F2)>0,IF(F2=0,TRUE,FALSE),FALSE))
Notice how the formula had the cells shift over.
The problem occurs when it gets to cell C2, which considers the formula as this:
=IF(LEN(F2)>0,IF(F2=0,TRUE,FALSE),IF(LEN(G2)>0,IF(G2=0,TRUE,FALSE),FALSE))
Presumably neither F2 nor G2 contains the data you're looking for, which is why the conditional formatting rule is not applied.
To fix this, you can change the formula to an absolute reference so that it always refers to the D and E columns, like so:
=IF(LEN($D2)>0,IF($D2=0,TRUE,FALSE),IF(LEN($E2)>0,IF($E2=0,TRUE,FALSE),FALSE))
This way, all cells in the 2nd row will consider precisely the above formula when checking the formatting (i.e. the cells will not shift).
On a side note, parts of your formula are redundant.
= IF(<condition>,TRUE,FALSE)
is equivalent to just
= <condition>
And additionally, if a third argument in an IF statement is not specified, FALSE is the default.
That being said, this formula can be simplified to:
=IF(LEN($D2)>0,$D2=0,IF(LEN($E2)>0,$E2=0))

Conditional Formatting statement issue

I am getting the most bizarre outcome from a conditional format that I can't seem to solve. My statement is
=AND($C$1<6,$J6=$C$2)
Whereas C1 is a number, J6 is the first cell to be checked, and C2 is the number I need matched.
In all I would like the cell to format if C1 is less than 6 and the cell matches the text in C2.
It is currently highlighting 5 completely seemingly random cells that are not a match??

Conditional Formatting (If cell above and below is number, format only cell below)

I'am trying to create a conditional formatting which formats only cell below, but only if cell above and cell below both has number in them (negative or positive).
Now i got this:
=ISNUMBER(OFFSET(INDIRECT(ADDRESS(ROW(); COLUMN()));-1;0))
This formats the cell below if the cell above has a anything. It does not respect the condition where the cell below also must have a number.
Could somebody help me out here? I am realy stuck :)
EDIT:
So now i tried this:
=AND(ISNUMBER(INDIRECT(ADDRESS(ROW();COLUMN()))); ISNUMBER(OFFSET(INDIRECT(ADDRESS(ROW();COLUMN()));-1;0)))
But no luck whith this one either.
Just to clarify. This formula should run on $A$3:$BB$100
So for example if:
A5 = 10 (or any positive or negative number)
A6 = 10 (or any positive or negative number)
A6 should be formatet.
But if:
A5 = 10 (or any positive or negative number)
A6 = EMPTY
No formating should happen.
Hope this clarify what i'am trying to do :)
=AND(ISNUMBER(A5),ISNUMBER(A6)) This formula will also bypass formatting for A6 as well if both cells are empty. I assume that's what you want, as there's no value within either to format.
I see why we are getting different results with the formula. Conditional formatting is applied relative to the active cell when applied. Start with cell A2 as the first cell highlighted, (A2:A100),and then use this formula =AND(ISNUMBER(A2),ISNUMBER(A1)).Cell A2 should be the first active cell within the range of applied formatted cells.

Resources