SOLVED

Conditional format cells in spilled ranges as formulas

%3CLINGO-SUB%20id%3D%22lingo-sub-1407783%22%20slang%3D%22en-US%22%3EConditional%20format%20cells%20in%20spilled%20ranges%20as%20formulas%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1407783%22%20slang%3D%22en-US%22%3E%3CP%3EHi!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20recently%20learned%20that%20I%20can%20conditionally%20format%20a%20range%20by%20using%20the%20formula%20%3DISFORMULA(topLeftCellOfRange)%2C%20though%2C%20I%20also%20then%20learned%20it%20doesn't%20work%20on%20spilled%20ranges%2C%20like%20when%20spilling%20with%20the%20%3DUNIQUE%20formula.%20See%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fimgur.com%2FHpWOxSj%22%20rel%3D%22nofollow%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fimgur.com%2FHpWOxSj%3C%2FA%3E%26nbsp%3Bor%20attached%20image%3A%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22conditionalformulanotworking.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F193491i35FE85216246A0FE%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22conditionalformulanotworking.png%22%20alt%3D%22conditionalformulanotworking.png%22%20%2F%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSTRONG%3ENote%3A%3C%2FSTRONG%3E%20Column%20M%20does%20have%20values%20in%20the%20purple%20cells%2C%20I%20just%20censored%20them.%20Then%2C%20all%20subsequent%20columns%20(N%3AY)%20are%20looking%20up%20data%20by%20matching%20with%20M5%23%3CBR%20%2F%3E%3CBR%20%2F%3EAs%20you%20can%20see%2C%20the%20ISFORMULA%20formula%20is%20only%20applied%20to%20row%205%20as%20that%20is%20the%20only%20one%20that%20%3CEM%3Eactually%3C%2FEM%3E%20has%20a%20formula.%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20reason%20I%20cannot%20use%20the%20rule%20%22No%20blanks%22%20is%20because%20I%20am%20actually%20forcing%20blanks.%20In%20S5%20my%20formula%20is%20basically%3A%20%3DIF(formula%3D0%25%2C%22%22%2Cformula)%20so%20that%20I%20can%20hide%20the%20data%20label%20in%20the%20stacked%20column%20chart%20that%20I%20am%20using%20my%20data%20table%20for.%3CBR%20%2F%3E%3CBR%20%2F%3EAny%20suggestions%20of%20an%20alternative%20formula%20to%20use%20in%20the%20conditional%20formatting%2C%20so%20that%20Excel%20understands%20that%20it%20should%20actually%20color%20the%20SPILLED%20range%3F%20In%20other%20words%2C%20not%20just%20N5%3AY5%2C%20but%20N5%3AY8%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1407783%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1408008%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20format%20cells%20in%20spilled%20ranges%20as%20formulas%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1408008%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F675376%22%20target%3D%22_blank%22%3E%40Luggruff%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYour%20formula%20doesn't%20make%20the%20cell%20blank%2C%20it%20returns%20empty%20string.%20So%20far%20in%20Excel%20formulas%20don't%20return%20blank%20as%20a%20value.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThus%20if%20the%20purpose%20is%20to%20color%20all%20cells%20with%20any%20value%2C%20includes%20empty%20string%2C%20you%20may%20apply%20rule%20like%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%3DISTEXT(N5)%20%2B%20(LEN(N5)%26gt%3B0)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1408069%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20format%20cells%20in%20spilled%20ranges%20as%20formulas%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1408069%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F675376%22%20target%3D%22_blank%22%3E%40Luggruff%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnother%20approach%20is%20to%20test%20whether%20each%20conditionally%20formatted%20cell%20intersects%20the%20spilt%20range%20or%20not.%26nbsp%3B%20That%20is%2C%20to%20use%20a%20conditional%20format%20based%20upon%20the%20formula%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3D%20isDA%3F%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3Ewhich%20refers%20to%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CFONT%3E%3D%20ISREF(thisCell%20spilt.range%23)%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CFONT%3Ewhere%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%3E'%3CSTRONG%3EthisCell%3C%2FSTRONG%3E'%20is%20a%20relative%20reference%20to%20the%20current%20cell%20(%3D%3CSTRONG%3ERC%3C%2FSTRONG%3E%20in%20R1C1%20notation)%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%3E'%3CSTRONG%3Espilt.range%3C%2FSTRONG%3E'%20is%20the%20anchor%20cell%20of%20the%20calculation%20range.%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1408094%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20format%20cells%20in%20spilled%20ranges%20as%20formulas%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1408094%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3Bthat%20absolutely%20did%20the%20trick!%20Will%20have%20to%20remember%20this.%20So%20any%20cell%20that%20is%20text%2C%20and%20any%20cell%20that%20has%20text%20(because%20that%20is%20how%20Excel%20reads%20it%2Fwhat%20I%20tell%20Excel%20to%20output%20with%20%22%22)%20with%20a%20length%20of%200%20characters%20(%22%22)%20-%20correct%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1409326%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20format%20cells%20in%20spilled%20ranges%20as%20formulas%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1409326%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F675376%22%20target%3D%22_blank%22%3E%40Luggruff%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI'd%20say%20any%20cell%20with%20any%20value%20except%20empty%20string%20(len%26gt%3B0)%20OR%20empty%20strings%20(for%20it%20len%3D0%20but%20it's%20the%20text%20)%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Hi!

 

I recently learned that I can conditionally format a range by using the formula =ISFORMULA(topLeftCellOfRange), though, I also then learned it doesn't work on spilled ranges, like when spilling with the =UNIQUE formula. See https://imgur.com/HpWOxSj or attached image:conditionalformulanotworking.png
Note: Column M does have values in the purple cells, I just censored them. Then, all subsequent columns (N:Y) are looking up data by matching with M5#

As you can see, the ISFORMULA formula is only applied to row 5 as that is the only one that actually has a formula.

The reason I cannot use the rule "No blanks" is because I am actually forcing blanks and if I do, then S5 will be white as it is a blank technically. Also, my range varies all the time, so it can extend longer than row 8. In S5 my formula is basically: =IF(formula=0%,"",formula) so that I can hide the data label in the stacked column chart that I am using my data table for.

Any suggestions of an alternative formula to use in the conditional formatting, so that Excel understands that it should actually color the SPILLED range? In other words, not just N5:Y5, but N5:Y8?

4 Replies
Highlighted
Solution

@Luggruff 

Your formula doesn't make the cell blank, it returns empty string. So far in Excel formulas don't return blank as a value.

 

Thus if the purpose is to color all cells with any value, includes empty string, you may apply rule like

=ISTEXT(N5) + (LEN(N5)>0)

 

Highlighted

@Luggruff 

Another approach is to test whether each conditionally formatted cell intersects the spilt range or not.  That is, to use a conditional format based upon the formula 

= isDA?

which refers to

= ISREF(thisCell spilt.range#)

where

'thisCell' is a relative reference to the current cell (=RC in R1C1 notation)

'spilt.range' is the anchor cell of the calculation range.

Highlighted

@Sergei Baklan that absolutely did the trick! Will have to remember this. So any cell that is text, and any cell that has text (because that is how Excel reads it/what I tell Excel to output with "") with a length of 0 characters ("") - correct?

Highlighted

@Luggruff 

I'd say any cell with any value except empty string (len>0) OR empty strings (for it len=0 but it's the text )