Format cells in row conditionally based on the first cell - excel

Is it possible to reference a cell outside the "Applies to" area in a conditional formatting formula?
I have a small table in which I would like any blank cells to be highlighted only if the first cell of the respective table row is not blank. The first cell should never be highlighted.
I would rather not use Visual Basic, if I don't have to.
Thanks

Yes, you sure can. You can use the formula:
=AND(NOT(ISBLANK(A$1)),ISBLANK(A2))
Where the first row is in 1:1, A2 is the active cell.

Related

Conditional formatting many cells by individual formulae

I want to apply a conditional formatting (CF) rule to a group of cells to individually colour them if their individual cell values are greater than a threshold (in this case >=5). To illustrate:
The top row shows how I want the bottom row to look. For the bottom row I cannot figure out how correctly format according to cell-specific formulae.
The problem is identifying a way to specify cell-specific CF formulas in a single operation for a group of cells - as you can by pasting/dragging normal cell formulas. I obviously don't want to have to manually specify the formula for each cell!
Grateful for assistance.
Select the rows or columns or range that you want to conditional format,
Enter the below formula in the formula bar in conditional format and choose a fill color,
=AND(A1>=5,ISNUMBER(A1))
If you are starting in row3, change the A1 to A3. The $ that you have in the formula makes it absolute. It should be relative.
You just select all required cells to format. Then go to conditional formatting.
Check what is the cell shown just before the formula bar (the single cell that represents the selected range, also called default cell) and use that cell in your formula without absolute reference. like B3>=5 or R3>=5

How to reference values within a different cell for conditional formatting over multiple columns

I am currently trying to write a rule for conditional formatting that will highlight the relevant cells if they show up within other referenced cells.
For eg. the data has 10 columns but I am only interested in highlighting the two cells in the same row from two of the columns if the values within them are both present within the referenced cells. These referenced cells are not part of the 10 columns and exist on a different sheet.
Essentially my logic is something like "if cellA exists inside reference cellA and cellB exists insde reference cellB then highlight cellA and cellB". Even if the whole row got highlighted that would still be sufficient for now.
Any pointers would be greatly appreciated.
Thanks!
Click the cell that you want to create a Conditional Formatting rule. (in this example I assume it's A1)
Then Create a New Rule
Then choose Use a formula to determine which cells to format
Then copy this formula: (I assume the Reference's worksheet name is Sheet1 and your 10 column range is B:K)
=COUNTIF(Sheet1!B:K,A1)
Also don't forget to choose your conditional formatting type (colour, border shape ant etc.)
I understand you question in 2 different ways.
1) Highlight cells if the same row contains both of the data from the referenced cells:
Assuming your referenced cells are A1 and B1 in Sheet1,
Select all the 10 columns in Sheet2
In home tab, select conditional formatting --> new rule
Select "Use formula to determine which cells to format"
Enter the below formula in the formula box.
=AND(COUNTIF(1:1,Sheet1!$A$1),COUNTIF(1:1,Sheet1!$B$1))
Select a fill color and press OK. This will highlight the row if both the values in referenced cells are present in the row.
2) Highlight cells if the cells contain either of the data in referenced cells.
Use the below formula,
=OR(A1=Sheet1!$A$1,A1=Sheet1!$B$1)
Let me know if you need any info.

Conditional Formatting for a row when there is a text disagreement between two cells

I'm working on a conditional formatting issue. I would like the whole row to highlight if the text in the same row in columns B and C disagree. So far, I've been able to write conditional formatting rules that leave the cell un-touched if there is no data and if there is a data entry that disagrees with the text in Column B, but I can't seem to get the formula to apply to the full row.
Here is what I currently have:screenshot of the document with conditional formatting rules visible
I'm working on Excel 2010. Maybe there is a way to use a logic formula?
I look forward to hearing suggestions!
You can do this with a formula. Highlight the range you would like to format, create a new conditional format, select "Use a formula..." and enter the formula as it would apply to the first cell or in this case row.
In my case, I chose the first 6 rows: $1:$6 as my range. So in this case, I would enter the formula as if I were only entering it for my first cell. The formula =$B1<>$C1 will check for inequality between B1 and C1 in the first row, B2 and C2 in the second row, and so on.

Conditionally format column A if cell row contains "z"

I want to highlight cells in column A (using the conditional formatting tool) if the cell's corresponding row contains the letter z anywhere within that row. I want to do this so I can sort data to the top if it is highlighted in column A.
I'm using the formula:
=COUNTIF($A1:$AA1,"*z*")
But I don't want to highlight the entire row, just the corresponding cell in column A for that row.
What is the formula to do this?
Select ColumnA then HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=COUNTIF($A1:$AA1,"*z*")>0
Format..., select highlighting OK, OK.
This will apply only to Column A (because of the selection).
This seemed to work for me when testing with a 3x3 cell table:
Highlight A1:A3
Conditional Formatting>New Rule>Use a formula to determine which cells to format
Formula:
=COUNTIF($B1:$C1,"z")
Then only cells in A were highlighted.
"I want to do this so I can sort data to the top if it is highlighted
in column A."
Ok, first of all, you don't need to use conditional formatting to sort. Second of all you wouldn't want to reference A1 in your formula =COUNTIF($A1:$AA1,"z") - it is a circular reference and any formula you put in column A would not return "z" anyways because you are using it for your COUNTIF formula.
The formula you want to use is:
=IF(COUNTIF($B1:$AA1,"z")>0,1,0)
If you want to look for any row that contains a z anywhere in a string you would want to do a wildcard countif:
=IF(COUNTIF($B1:$AA1,"*z")>0,1,0)
Then you can just sort on column A for all your data - high to low.
Basically you have demonstrated a basic misunderstanding of how to sort in excel(no offense). This should help you. Good Luck.

Highlight cells in a row where the value of a particular cell is different to that of the previous row

I'd like to apply some conditional formatting where each cell of a row is compared to the cell in the previous row. If it differs then the row is highlighted.
I'm using Excel 2007. Is this even possible? If so could someone provide me with the steps to apply this to an entire table of data?
Yes, it is possible. It was possible in previous versions of Excel, too.
The condition is very simple.
Select the data, starting from the second row of data (the third row counting from the header), bring up the condition formatting dialog, select "Formula" and enter =A3<>A2, =A3<>OFFSET(A3,-1,0) where A3 is the top-left cell of the selection.
Note the absence of dollar signs - Excel will automatically suggest them, so delete accordingly.
Because the reference is not absolute, the formatting will properly apply to the whole table.
You can make it even more versatile, like this:
=INDIRECT(ADDRESS(ROW(), COLUMN()))<>INDIRECT(ADDRESS(ROW()-1, COLUMN()))
Here's how it works:
=ADDRESS(ROW(), COLUMN()) refers to the current cell (i.e. the one to be formatted).
Similarly, =ADDRESS(ROW()-1, COLUMN()) refers to the cell above the current cell. Then all I do is compare the two.

Resources