SOLVED
Home

Conditional format cells only that contain a sequence of blanks

%3CLINGO-SUB%20id%3D%22lingo-sub-798738%22%20slang%3D%22en-US%22%3EConditional%20format%20cells%20only%20that%20contain%20a%20sequence%20of%20blanks%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-798738%22%20slang%3D%22en-US%22%3EHi%20all%2C%20I%20need%20some%20help%20trying%20to%20nut%20out%20a%20conditional%20formating%20formula.%20I%20need%20to%20only%20highlight%20cells%20that%20contain%203%20or%20more%20blanks%20in%20sequence%20in%20a%20row%20(range%20E2%3AO2)%20The%20desired%20outcome%20is%20to%20highlight%20the%20cell%20A2%20as%20row%20A%20has%203%20or%20more%20blanks%20in%20a%20row.%20Following%20this%20A6%20will%20highlight%20but%20the%20remaining%20A%20cells%20will%20remain%20not%20highlighted.%20If%20any%20advice%20can%20be%20given%20for%20the%20formula%20to%20use%20it%20would%20be%20amazing!%20Thanks%20E.g.%20below%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-798738%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-798745%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20format%20cells%20only%20that%20contain%20a%20sequence%20of%20blanks%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-798745%22%20slang%3D%22en-US%22%3EUPDATE%3A%20incorrect%20information%20below%3A%20%22The%20desired%20outcome%20is%20to%20highlight%20the%20cell%20A2%20as%20row%20A%20has%203%20or%20more%20blanks%20in%20a%20row.%20%22%20Row%202%20is%20the%20correct%20reference.%20Thanks%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-798974%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20format%20cells%20only%20that%20contain%20a%20sequence%20of%20blanks%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-798974%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F390390%22%20target%3D%22_blank%22%3E%40SeanC3%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20may%20apply%20to%20your%20range%20in%20column%20A%2C%20starting%20from%20A2%2C%20conditional%20formatting%20rule%20with%20formula%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-ruby%22%3E%3CCODE%3E%3DCOUNTBLANK(%24E2%3A%24O2)%26gt%3B%3D3%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-807620%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20format%20cells%20only%20that%20contain%20a%20sequence%20of%20blanks%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-807620%22%20slang%3D%22en-US%22%3EHi%20Sergei%2C%20This%20formula%20is%20identifying%20rows%20with%20the%20required%20amount%20of%20blank%20cells%2C%20but%20is%20there%20a%20way%20to%20identify%20blanks%20in%20a%20sequence%3F%20Say%20row%202%20has%204%20blanks%20cells%20(I2%3AL2)%20but%20row%204%20only%20has%20a%20maximum%20is%202%20blanks%20in%20sequence%2C%20I%20need%20to%20identify%20only%20the%20rows%20that%20have%204%20or%20more%20blanks%20in%20sequence.%20Is%20this%20possible%3F%20Thanks%20for%20your%20help.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-808044%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20format%20cells%20only%20that%20contain%20a%20sequence%20of%20blanks%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-808044%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F390390%22%20target%3D%22_blank%22%3E%40SeanC3%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20count%20max%20number%20of%20sequential%20blanks%20you%20may%20use%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3DMAX(FREQUENCY(IF((%24E2%3A%24O2%3D%22%22)%2CCOLUMN(%24E2%3A%24O2))%2CIF(%24E2%3A%24O2%26lt%3B%26gt%3B%22%22%2CCOLUMN(%24E2%3A%24O2))))%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Esee%20in%20Column%20P%20attached.%20In%20general%20it%20shall%20be%20array%20formula%20(Ctrl%2BShift%2BEnter)%2C%20but%20I'm%20on%20Dynamic%20Array%20Excel%20now%20and%20can't%20test.%20Column%20A%20is%20highlighted%20using%20this%20formula.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-809284%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20format%20cells%20only%20that%20contain%20a%20sequence%20of%20blanks%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-809284%22%20slang%3D%22en-US%22%3ESergei%2C%20you%20are%20brilliant!%20Thank%20you%20this%20is%20perfect%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-809302%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20format%20cells%20only%20that%20contain%20a%20sequence%20of%20blanks%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-809302%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F390390%22%20target%3D%22_blank%22%3E%40SeanC3%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20involves%20a%20bit%20of%20lateral%20thinking%20to%20transform%20your%20problem%20into%20a%20form%20that%20is%20easy%20to%20solve.%26nbsp%3B%20Given%20the%20range%2C%20I%20defined%20a%20Named%20Formula%20'signature'%20using%20Name%20Manager%20to%20refer%20to%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CFONT%3E%3D%20CONCAT(%20N(ISBLANK(range))%20)%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CFONT%3EThat%20gives%20a%20binary%20string%20with%201%20for%20a%20blank%20cell%20and%200%20otherwise.%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%3EThe%20next%20step%20was%20to%20search%20the%20string%20for%20the%20occurrence%20of%20%22111%22%20using%20the%20named%20formula%20'%3CSTRONG%3Eformat%3F%3C%2FSTRONG%3E'%20which%20refers%20to%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CFONT%3E%3D%20IFERROR(%20SEARCH(%22111%22%2C%20signature%20)%2C%200%20)%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%3EThe%20conditional%20format%20then%20is%20based%20upon%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CFONT%3E%3D%20format%3F%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CFONT%3EA%20side%20benefit%20is%20that%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CFONT%3E%3D%20INDEX(%20range%2C%20format%3F%20)%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CFONT%3Eis%20the%20first%20cell%20of%20the%20three%20or%20more%20consecutive%20blank%20cells.%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-809437%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20format%20cells%20only%20that%20contain%20a%20sequence%20of%20blanks%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-809437%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F390390%22%20target%3D%22_blank%22%3E%40SeanC3%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20are%20welcome.%20Forgot%20to%20say%2C%20array%20formula%20(CSE)%20if%20only%20you%20use%20it%20for%20the%20calculation%20in%20the%20cell.%20Within%20the%20rule%20you%20may%20use%20it%20as%20regular%20one%2C%20Conditional%20Formatting%20is%20smart%20enough%20to%20recognise%20array%20calculation.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-809448%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20format%20cells%20only%20that%20contain%20a%20sequence%20of%20blanks%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-809448%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F214174%22%20target%3D%22_blank%22%3E%40Peter%20Bartholomew%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPeter%2C%20great%20idea%20with%20binary%20string%3C%2FP%3E%3C%2FLINGO-BODY%3E
SeanC3
New Contributor
Hi all, I need some help trying to nut out a conditional formating formula. I need to only highlight cells that contain 3 or more blanks in sequence in a row (range E2:O2) The desired outcome is to highlight the cell A2 as row A has 3 or more blanks in a row. Following this A6 will highlight but the remaining A cells will remain not highlighted. If any advice can be given for the formula to use it would be amazing! Thanks E.g. below
8 Replies
UPDATE: incorrect information below: "The desired outcome is to highlight the cell A2 as row A has 3 or more blanks in a row. " Row 2 is the correct reference. Thanks

@SeanC3 

You may apply to your range in column A, starting from A2, conditional formatting rule with formula

=COUNTBLANK($E2:$O2)>=3

 

Hi Sergei, This formula is identifying rows with the required amount of blank cells, but is there a way to identify blanks in a sequence? Say row 2 has 4 blanks cells (I2:L2) but row 4 only has a maximum is 2 blanks in sequence, I need to identify only the rows that have 4 or more blanks in sequence. Is this possible? Thanks for your help.
Solution

@SeanC3 

To count max number of sequential blanks you may use

=MAX(FREQUENCY(IF(($E2:$O2=""),COLUMN($E2:$O2)),IF($E2:$O2<>"",COLUMN($E2:$O2))))

see in Column P attached. In general it shall be array formula (Ctrl+Shift+Enter), but I'm on Dynamic Array Excel now and can't test. Column A is highlighted using this formula.

Sergei, you are brilliant! Thank you this is perfect

@SeanC3 

This involves a bit of lateral thinking to transform your problem into a form that is easy to solve.  Given the range, I defined a Named Formula 'signature' using Name Manager to refer to

= CONCAT( N(ISBLANK(range)) )

That gives a binary string with 1 for a blank cell and 0 otherwise.

 

The next step was to search the string for the occurrence of "111" using the named formula 'format?' which refers to

= IFERROR( SEARCH("111", signature ), 0 )

 

The conditional format then is based upon

= format?

A side benefit is that

= INDEX( range, format? )

is the first cell of the three or more consecutive blank cells.

 

 

 

@SeanC3 

You are welcome. Forgot to say, array formula (CSE) if only you use it for the calculation in the cell. Within the rule you may use it as regular one, Conditional Formatting is smart enough to recognise array calculation.

@Peter Bartholomew 

Peter, great idea with binary string

Related Conversations
Extentions Synchronization
Deleted in Discussions on
3 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
9 Replies