How to autofill the condition in conditional formatting in Excel? - excel

Column A has a number 1-10. Column B has a string I want to highlight with conditional formatting. How do I make it so that if the number in Column A is greater than 7, the cell in the same row in Column B will automatically turn blue?
I use the conditional formatting tool for cell B1 such that, in the "Use a formula to determine which cells to format" option, I have ="IF($A1 > 7)", then fill the cell with blue.
But, as I drag/autofill down, the 1 in $A1 does not become A2, A3, A4, A5, A6, etc. as I want it to. What am I doing wrong?

Change the formula to:
=$A1 > 7
And take a look at my yoursumbuddy post, which explains why you don't need IFs in Conditional Formatting:

Select B1, then column B (This should make all the cells bluish except the cell B1, which is said to be the 'active' cell).
Open up conditional formatting and use the formula:
=IF($A1 > 7, 1)
You need to at least specify the value if true and there's no need to drag the conditional formatting down.

Related

Highlight A1 if A2 does not equal A1, B1 does not equal B2, and so on

For example, I have A1 that has a formula to add the sum of multiple other cells, then A2 I enter a number each week. A1 and A2 must match, if they don't then a mistake has been made. I want Row 2 to highlight if it does not match. I can figure this out but I cannot figure how to copy that in conditional formatting to apply to B1 and B2, C1 and C2, D1 and D2, E1 and E2, and so on.
From what I understand, you want to have row 2 highlighted if any of the cells in it is different from the corresponding cell in row 1. You do not want to have highlighted only the offending cells.
The only way I know to do it, short of VBA, is to create a helping row, let's say row 3, where you put =A1=A2 in cell A3, then copy it to the entire row. Then, while cell A2 is active, select the entire row 2, and create a conditional formatting rule with formula =NOT(AND(3:3))
UPDATE 03/04/21 Here a faster method (no helping row):
Select the row 2, and in the Conditional Formating, put this formula:
=SUMPRODUCT(-(1:1<>2:2))<0

Auto increment conditional formatting formula

I have a table which has two columns with a percentage value in each:
I would like every cell in the B column to be highlighted red if it is greater than the corresponding cell in the A column.
I have used the conditional formatting formula in cell B2:
=B2>A2
When copying down this conditional formatting formula into the rest of the cells in the B column, the formula does not auto increment. The expected behavior is that it would auto increment. E.g. in cell B3 the formula would auto increment to:
=B3>A3
When adding the formatting, I highlighted the whole B column rather than just the cell B2. I have also ensured the whole range is selected in the 'manage rules' section:

Check if value of a cell is available in another sheet in Excel

Alright so I have a question and need assistance.
I need to check if the value on cell A1 (sheet 1) is available in coloumn 1 (sheet 2). If YES, cell A2 (sheet 2) should turn green, if NO, cell A2 (sheet 2) should remain blank/colourless.
Please help me on this at the soonest.
Thanks,
Ibrahim
In cell A2 on Sheet2, put in the formula:
=IFERROR(VLOOKUP(A1,Sheet2!Range,1,FALSE),0)
Range: As you want it. Eg. A1: A100, A1: A10000 etc
Explanation:
The Vlookup formula is used to see if the value in A1 is in the range you selected on Sheet2. IfError is to put in the value of 0 in case the value isn't there in Column1 of Sheet2
On cell A2 now, Goto Home> Conditional formatting > Highlight Cell Rules > Equal to > 1
Then you can select the type of color you want from the subsequent box.
Then if the value in cell A1 is in Column 1 of sheet2 you would have the color of cell A2 turning to what you had selected above.
Depends on exactly what you mean by "available". Let's assume you mean Sheet1 / Cell A1 is a formula, and you want to ensure the formula was able to evaluate, that is, not result in a #VALUE! or other error.
Then you need a conditional format. Click on sheet 2, Cell A2. From the Home ribbon, choose Conditional Format -> Manage Rules... and choose New Rule. Tell Excel you want the bottom option, "Enter as the formula to decide which cells to format" then enter for the formula:
=NOT(ISERROR(Sheet1!$A$1))
and click OK. Set the format by going to the "Fill" tab, where you choose whatever color. Other variations are possible: =ISNUMBER(Sheet1!$A$1) to ensure cell A1 contains a number, ISTEXT(), etc. Is that enough detail?

Conditionally format one cell based on values in a column

The user enters a date/time into cell B2. If this matches one of the values in column L I would like to format cell B2 as red, else format cell B2 as green.
Any idea how to do this?
Please format B2 green with standard fill, then apply the following Use a formula to determine which cells to format, Format values where this formula is true:
=match(B2,L:L,0)>0
with formatting (red) to suit and Applies to B2.
Assuming you are using Excel 2007 onwards:
Set cell shading for B2 = Green
Select Cell B2 and select the Conditional Formatting > New Rule menu item
Use a formula to determine which cells to format
In the formula bar, put in =ISNUMBER(MATCH(B2,$L$6:$L$100,0))
For format, change shading to Red
Obviously change the $L$6:$L$100 to suit you, but that should do it...
What about breaking this up into two steps.
Try putting a simple formula in Cell B1:
=ISNUMBER(MATCH(B2, L:L, 0))
This will return a TRUE if there's a match and a FALSE if there is not a match. Then make two conditional rules based on Cell B1.

Excel - programm cells to change colour based on another cell

I am trying to create a formula for Excel whereby a cell would change colour based on the text in the previous cell.
So for example if cell B2 contains the letter X and then B3 is Y, I would like B3 to turn green.
Equally, if B2 contains X and B3 contains W I would like B3 to turn red.
Any ideas much appreciated!
Select cell B3 and click the Conditional Formatting button in the ribbon and choose "New Rule".
Select "Use a formula to determine which cells to format"
Enter the formula: =IF(B2="X",IF(B3="Y", TRUE, FALSE),FALSE), and choose to fill green when this is true
Create another rule and enter the formula =IF(B2="X",IF(B3="W", TRUE, FALSE),FALSE) and choose to fill red when this is true.
More details - conditional formatting with a formula applies the format when the formula evaluates to TRUE. You can use a compound IF formula to return true or false based on the values of any cells.
Select ColumnB and as two CF formula rules apply:
Green: =AND(B1048576="X",B1="Y")
Red: =AND(B1048576="X",B1="W")
Use conditional formatting.
You can enter a condition using any cell you like and a format to apply if the formula is true.

Resources