excel conditional formatting vlookup does not contain value - excel

I have a formular for conditional formatting:
=VLOOKUP(H4;Anothersheet.A$4:$A$20;1;FALSE)=H4
When the value of H4 is found in the given range Anothersheet.A$4:$A$20, the cell gets colored in red. But I want to color the cell red if the value is not found. How can i achieve this?
I have tried the following formulars:
=VLOOKUP(H4;Anothersheet!$A$4:$A$20;1;FALSE)<>H4
=NOT(VLOOKUPH4;Anothersheet!$A$4:$A$20;1;FALSE)=H4)
But this doesn't work. In both cases the cell does not get colored (if the value exists in the given range and if the value does not exist in the given range).

User COUNTIF() for this:
=COUNTIF(Anothersheet!$A$4:$A$20,H4)=0
When not found your VLOOKUP() returns #N/A.
That being said, you can also edit your formula into:
=ISERROR(VLOOKUP(H4;Anothersheet!$A$4:$A$20;1;FALSE))

Related

Conditional Formatting Depending on Text In Separate Cells in Excel

I'm trying to have one column change color (individual cells in that column, rather) depending on if there is text in a different cell in the same row. I've tried using something along the lines of =IF(($B1<>""), TRUE, FALSE) and that works, but when I try to copy that formatting to the rest of the column, the cell number that the formula references stays the same, so every cell in column A will reference cell B1 instead of changing the reference cell to B2, B3, etc... on down the column.
The problem with your formula i'm assuming is the $ sign which is an absolute reference. So if you use $B1 in your formula, you're saying that you need to always compare against the value in column B.
using this formula should probably work for you:
=IF(B1<>"", TRUE, FALSE)
But it also depends on the range that you're applying this conditional-format on.
TIP:
You don't even have to use the IF function, B1<>"" returns TRUE or FASLE by default.

How can I automaticly color a cell based on another cells content that I know?

I´m trying to fill a Cell based on the words "beim Baum." which could appear in different cells in the same line. If this is true for any cell I want a particular cell to turn yellow. All cells contain words or numbers and are formatted as numbers.
So for example cell A1 contains "beim Baum." so I would like B1 to turn yellow. it should also turn yellow if C1 contains "beim Baum."
I know the conditional formatting formula for filling in a cell based on an exact word would be Rule $A1="beim Baum." Applies to =$B1, but this does not work.
I also tried: =SEARCH("beim Baum.",$B1)
and: =ISNUMBER(SEARCH("beim Baum.",$B1))
No matter which formula nothing happend
The ISNUMBER SEARCH approach is correct.
Lets have complete example:
Conditional formatting rule based on formula:
=ISNUMBER(SEARCH("beim baum",$A1&$C1))
is applied to =$B$1:$B$8.

Excel Formula vs Formula used in conditional format

I have a excel formula which correctly returns true. But when I used the same formula in conditional format, I am not able to get the conditional format. Please help.
=AND(FIND("MyText",INDIRECT(ADDRESS(1,COLUMN()))),INDIRECT(ADDRESS(ROW()+2,COLUMN()))=1)
If the first cell of the column is "My-text" and the value is 1 (in row +2, same column) the formula correctly returns true. If I used it in a conditional format to paint a fore-ground color it is not working. I also tried search and searchb. But didnt work. The format of the cell (row() +2, column) that might have value 1 is "General"
If you change to R1C1 reference style, you can enter the formula as =AND(R1C="MyText", R[2]C=1)
R1 means row 1, C means same column, and R[2] means 2 rows below the current cell.
In A1 reference style, the formula will depend on the currently active cell, so if for example the active cell is A1, the formula will be =AND(A$1="MyText", A3=1)
Not sure why this wouldn't work. But you can simply replace the AND function with *. Here is what you can try:
=FIND("MyText",INDIRECT(ADDRESS(1,COLUMN())))*INDIRECT(ADDRESS(ROW()+2,COLUMN()))=1
I changed the AND into following and it worked. But not sure what is the issue with AND in conditional format
=NOT(ISERROR(SEARCH("MyText",INDIRECT(ADDRESS(1,COLUMN())))))
*INDIRECT(ADDRESS(ROW()+2,COLUMN()))
Added the above answer for reference.

Conditional formatting: combining multiple checks

Right now I check if a cell is blank, if it is, it becomes red.
=ISBLANK($B$12)
However this cell only needs to be red when it's empty AND another condition is met: the cell above needs to be set to "YES" or blank.
I tried doing something like:
=ISBLANK($B$12),($B$11)=!"NO"
But that doesn't really work.
The AND function can combine the logic in the manner you are looking for. Try the following,
=AND(ISBLANK($B$12), NOT($B$11="NO"))
'or,
=AND($B$12="", $B$11<>"NO")
You will likely want to remove the $ absolute anchor from either the row or column if you want to apply that condition to more than a single cell.
These formulas are applied with the 'Use a formula to determine which cells to format' option. They are put into the 'Format values where this formula is true:' text box.
 
You could check for the cell being blank and above being "YES" with the following:
=AND(ISBLANK($B$12),EXACT($B$11, "YES"))

Excel Conditional Formatting, Referencing 2 cells to the Right with conditions

I have a list of students who are between the ages of 3 and 5. lets say column A has the code, Column D has the childs age & Column F has their age group (3-5) If their age exceeds the age group then the Cell in column A will highlight Red. I am just not sure how to write this code correctly, all of the combinations i have tried come up with an error or just don't do anything.
IF(OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN())),0,7)="3-5" & (OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN())),0,4)>5 {THEN FILL CELL RED} {ELSE NO FILL}
In the first part of the statement you are checking whether the cell 7 columns across = "3-5". You don't need to use offset for this, you can just reference the cell 7 across directly.
So if you're applying the conditional formatting to A1 that part of the formula would just be =IF(H1="3-5",{then},{else}).
If you just want TRUE or FALSE as the answer you don't need the IF statement, so this shortens to: =H1="3-5",
If you're applying the conditional formatting to a range instead of just an individual cell, say A1:B10, then you write the formula for the cell in the top left of the that range. So for A1:B10 you would still you the same formulae as above.
For the second part of the statement, using the same logic as above, you get: =E1>5
To check both statements together you need to wrap them in the =AND() function, giving you this as the final formula for your conditional formatting:
=AND(H1="3-5",E1>5)
By using the AND function I can achieve the desired result without cell references moving if a cell is relocated.
=AND(OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN())),0,7)="3-5yo",OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN())),0,4)>5)

Resources