How to Dynamically Format An Excel Spill Range? - excel

Microsoft is about to release a new "Spill" feature for Excel. At time of post, this not available in the current version, but insiders can use it.
Is there an "easy" (non-vba or conditional formatting) method to dynamically format the spilled range? Example (as shown in this file) is if a user changed a cell, which drives a spill range, is it possible that spilled range could hold certain formatting? Additionally, if the list shortened, I would want the formatting to resort to blank cell formatting.
In the example, I'm trying to use a certain gray format (the Style of output cell ) for the list. If you tinker around you can see the good/bad results.
I realize that Pivot Tables may be the better approach, I'm just more curious from a learning perspective if there's something I'm overlooking.

I use conditional formatting to do this. I just have a rule of "does not contain a blank" that applies to the whole column or my desired range. I also like to have banded rows, so I use a rule above that rule that just has the background the chosen banded color when this formula is satisfied:
=IF(MOD(ROW(),2)=1,TRUE)
Joe

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!

Conditional formatting based on other column

I have a table, that consists of 2 columns. I need to highlight values in first column, that are more or equal than 10% of the number in the second column.
I created additional row there, to clarify, but I can't use it in the formula, tho.
I need to use relative formula, since I am applying filter to these rows, so I need this all not to fall apart, if I am sorting table via filters.
I have looked through this topic: Excel Conditional Formatting based on Other Column , but I couldn't apply it. Or I failed at applying it.
I have tried to apply to the range (of =$A$2:$A$8)following formulas (in conditional formatting "Use a formula to determinate..."):
=$A2*100/$B2>=10
=ADRESS(ROW(),COLUMN())*100/ADRESS(ROW(),COLUMN()+1)>=10
But none of them did the trick. Can someone help me with this one, please? Thanks.
You misunderstand how conditional formatting works.
"I need to use relative formula ..."
No. You don't.
Conditional formatting, although I have never seen it stated anywhere, uses array-based formula. As such you describe the usage of the first instance in the (unfiltered) table, tell it the area of the table, and it will calculate the necessary relative addressing by itself. You do not tell it the relative addressing. Why it behaves like that, I can't tell you.
The formula will then maintain itself throughout any filtering or sorting you carry out. You do not need to account for filtering and sorting - provided, of course, you set everything up on the unfiltered table to begin with.
You can see from the attached screenshots, simply using your formula of =$A2*100/$B2>=10 and applying it to $A$2:$A$8 worked perfectly.

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

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

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.

Conditional data validation for MS Excel

i read some tutorials that help out with conditional (or dynamic) data validation, but its usually dynamically generating list item choices based on previous selection etc.
what i want is, lets say i have
columnA : columnB
telephone_number : 911
name: peterparker
is it possible for me to dynamically specify data validation rules on columnB based on what is selected in columnA? if its telephone_number, i want to check that the corresponding cell in columnB is a natural number, and if it is a name,i want to check for a string for a certain length. of course i limit the string options that the user can input in columnA.
Following formula on custom validation rules will do:
=IF(A1="telephone_number";ISNUMBER(B1);IF(A1="name";LEN(B1)=8;TRUE))
This is example for cell in B1. You may choose a wider range and combine $ to adapt you formula to all range.
An alternative to data validation is Conditional Formatting. The benefit of the latter is that it is more versatile. We can have the following setting:
Then if we define a name, DynamicValidation as follows:
the formula at the validation box is
=EVALUATE(SUBSTITUTE(VLOOKUP(Sheet1!$A2,Sheet1!$D$2:$E$3,2,0),"()","("&ADDRESS(ROW(),2)&")"))
EVALUATE cannot be used in any sheet cell, but it can be used in Named ranges. However, you will have to save your book as macro-enabled, because it is a legacy macro, originating from Excel 4.0. What it does is the following:
Looks at the value in List1 and finds the formula that needs to be checked (VLOOKUP).
Subtitutes "()" with the cell value of interest (and adds back the parentheses).
Then if you open a conditional formatting box (Home tab, Conditional Formatting, New Rule, Use a formula to determine....) and input the formula =Not(DynamicValidation) like this:
then each cell that does not adhere to the formula will turn red. I tried that with data validation as well, but it does not work unless we build the depencency tree every time we change List 2.. I am not sure why.. But only conditional formatting works :) Here are some screenshots:
The benefit is that we can change the validation criteria without hard-coding.
I hope this helps!

Resources