(Excel) conditional formatting based on adjacent cell, whole column - excel

I'm trying to highlight the changes in a long list of data, so I would like to have the cell shaded if its value is different than the cell above. I can implement this for a single pair of cells using conditional formatting, but I can't get it to work for a whole column. Here's what I want it to look like (I performed this shading manually, for this example):
I tried this, but it doesn't propagate down the column when I select the column.

First time responding to a question on Stack Overflow, so apologies if the formatting on this response is messy.
You will want the formula to read:
{ =A2<>A1 }
Conditional Formatting Rules Manager

Related

Dynamic Conditional Formatting Formula Based on Relative Cell References

I've read this forum for many Excel-related issues over the past 3-4 years, always finding answers when needed... but this time, I'm stumped.
I'm trying to use Conditional Formatting based on a formula to highlight values that are out out of range based on a cell that is a defined distance away. Specifically, the cell I will be attempting to format will be 8 cells to the right of the reference cell. (e.g., comparing R13 to J13, where J13 is the reference value). So the "Lower Spec Limit" is automatically generated from column J to Q, and the user inputs results in columns R to Y.
I would like to accomplish this without having 8 formulas, but so far I have been unable to figure out the right combination of AND/OR statements that will allow me to apply a single formula from row R to Y, where R>J, S>K, T>L, etc. are the conditions to be met.
In a nutshell, the formula I was using was basically:
=OR($R13>$J13,$S13>$K13,$T13>$L13)
Within the Conditional Formatting line. Of course, I then realized that this would format the entire affected range when any condition was met. I also tried to consider whether there was even data in the cell yet, but that got to be a messy way to highlight the entire range again anyway.
From other entries on this site, I've found that I need to:
Avoid INDIRECT references (can be unstable)
Potentially use OFFSET (although I'm unfamiliar within Excel formulas, only used in VBA in the past)
There will be other users for this spreadsheet, so that will have to be a condition.
Is this a feasible task, or would I be better off to have the 8 formulas (which will be 16 if I highlight based on "pass" and "fail" criteria)?
Thank you for your help!

Count number of cells in a column with conditional formatting from VLOOKUP

I've done some searching and I can't find anything that seems to match up with what I'm trying to do precisely. I'm familiar with Excel, formatting, and formulas, but by no means a master.
I have three sheets - Summary which is where the count value should be done, Tracker which is where the range to count is, and OrigTrackerData which has data used in the conditional formatting formula.
What I'm trying to do is count the number of cells within a certain table column that have a certain conditional formatting rule applied (rule below).
Here is the conditional formatting rule:
=A1<>VLOOKUP($A1,OrigTrackerData!$A:$L,COLUMN(),FALSE)
The intent of the rule, which is applied over the entirety of Table710 which exists in Tracker, is to determine which cells have changed relative to OrigTrackerData, regardless of row order of the two sheets - column A of both sheets have an "index" of sorts.
I've gotten as far as something like =COUNTIF(Table710[Notes], ???) but I can't determine how to convert the conditional formatting formula to a COUNTIF condition.
I am open to accomplishing this via VBA as well - I originally attempted to do so using color functions found here: http://www.cpearson.com/excel/colors.aspx but those functions apparently don't work on colors applied by conditional formatting.
Edit: BYate's comment neatly obviated the need for this. I am curious if something like this is possible though, but now just out of idle curiosity.

Excel conditional formating - conditional on sum of all previous cells and total sum

I have a question with regards to conditional formatting which I simply can't seem to solve.
The aim is to format the background color for the left-most cells that are blank up until a cell contains a value - and after this there should be no more formatting in this row. You can see an image of the result I'm hoping for beneath:
So far I've managed to create the conditional formatting of the blank rows, but sadly haven't managed to create the "single-cell" formatting (in yellow) conditional of the sum of all the first cells being = 0.
I've created a formula which actually succeeds in calculating the sum of the previous cells, but this formula includes INDIRECT() which it seems that conditional formatting doesn't allow. At least I'm getting an error starting with the follow (translating the error from Danish to English might not be intuitive):
You cannot use reference operators such as.....
The formula I'm trying is the following:
=AND(SUM(A2:INDIRECT(IF(COLUMN(A2)>=27;CHAR((64-26)+COLUMN(A2))&CHAR((64-26)+COLUMN(A2))&ROW(A2);CHAR((64)+COLUMN(A2))&ROW(A2))))>0;$K2>0)
Where $K2 is the sum of the row.
Is there a way to SUM a range of cells by doing something similar to this:
=SUM(B2:CHAR((64)+COLUMN())&ROW();"")) to dynamically SUM the range from B2 to the current cell? The problem in this case is whether the part CHAR((64)+COLUMN())&ROW();"") can be converted into a legible cell such as B4 to make it work inside the =SUM() formula?
Sadly the =ADDRESS() formula cannot be used (as far as I know) as this will trigger the same error in conditional formatting as well.
For now I would like this to work with the regular Excel conditional formatting, but if anyone have a simple VBA this would also have interest - however, I would by far prefer the regular solution.
The question:
Is there a way to create a formula that doesn't trigger this error - maybe by refrasing the formula or doing something completely else?
It seems to me that this could be handled with a much simpler CFR formula like,
=and(not(sum($a2:a2)), $k2)
Am I missing something?

Excel Formula If Cell Contains String

I'm currently working in excel, and I'm trying to figure out a way to find if multiple cells contain the string value of another cell, and if it does highlight the cell where the row and column meet up. I created an example of what I want, only it will be on a much larger scale.
I've tried using: =ISNUMBER(SEARCH(substring,text)) but I'm not quite sure how to use it the way I want to.
Any help will be appreciated!
Your approach is correct, we can use the fact that conditional formatting is applied like dragging a formula, adapting relative references.
Create a conditional formatting formula rule:
=ISNUMBER(SEARCH(B$1,$A2))
Applied to B2:D7
Your formula will work nicely; what you'll want to do is put that formula into all the cells you want to highlight, so you get FALSE and TRUE in every cell.
You'll then use two Conditional Formatting rules. The first will look for Cell Value = TRUE, and will set cell background and font colour to yellow. The second will look for Cell Value = FALSE, and will set cell background to No Colour and Font to White.
This will reproduce the result you're looking for.
Edited to add:
It is possible to do this using just Conditional Formatting too, but it's a little more fiddly. If you want to try it, you can do this:
Highlight your range, and take note of which cell is Active - that's the cell within your highlighted range that is still white. It's also the one whose address is shown in the Name box in the upper left. For the sake of this answer, we'll assume that's B2
Create a new Conditional Formatting rule. Choose "Use a formula to determine which cells to format".
Use the formula =ISNUMBER(SEARCH(B$1,$A2). Set the format to colour just the cell background.
Note where the $ appears in the formula above - you want to leave the row number anchored in the first part, and the column letter anchored in the second part.
This takes advantage of the fact that Conditional Formatting is able to use absolute, relative, and mixed references to find which cells to format. It's also a tidier solution, but it can be harder to maintain if the sheet is ever repurposed or modified.

How do I base conditional formatting on validation results in Excel?

I want to change the formatting of a cell if the cell is not valid. In this case, "valid" means that the cell has failed the data validation rules.
I'm asking this question because I couldn't find the answer on SO. I eventually solved it. I'll post my answer and see if people want to comment or provide a better answer!
Here's a basic outline that I want to turn into a better formatted answer later this week when I have more time.
Create a Data Validation rule. In my case, I referenced a list of data in another workbook.
Turn off the alert for invalid data, we'll use the conditional formatting to show the data is invalid.
Add a conditional formatting option for the cells that have the data validation rule. To do this, go to Manage Rules -> New Rule, and in the formula, use =IS_VALID(CELL("row",C4), CELL("col", C4)), where C4 is the first cell you want to start entering data into.
Create a custom function that looks something like
this:
Public Function IS_VALID(row, column) As Boolean
IS_VALID = Not Cells(row, column).Validation.value
End Function
Finally, you can set your conditional formatting effects to whatever you want, like coloring the cell red. This answer worked for me, and I wanted to not forget to add it to SO, but don't have the time to make it all pretty right now.
If you are referencing a list in another workbook, then it is simpler to recreate the data validation rule as a conditional formatting rule.
If your conditional formatting starts at Cell A1 on Sheet1, and the list is contained from A1:A10 on Sheet2, then your conditional formatting rule would be:
=AND($A1<>0,COUNTIF(Sheet2!$A$1:$A$10,$A1)<1)
This would highlight the cell if its value does not appear in the source list, and is not blank.
Clearly, for non-list based data validation, you can come up with an equivalent formula in the same manner.
You could make things more robust by setting up a named range for the list which both the data validation and conditional formatting refer to, such that if the list range grows, you only need to edit it in one place (the Name Manager), and it will update both Data Validation and Conditional Formatting ranges.

Resources