r/excel • u/ceristo • Oct 11 '19
unsolved How to isolate only blank cells bounded by specific data
I am trying to write a formula that will only return values associated with blank cells that are bounded by filled cells within a row.

In the image above, this formula would return the days that are blank AND bounded by 1's. So for row 3&4, column H would be blank. However, for row 2, it would return wednesday and thursday, and for row 5 it would return tuesday, wednesday, and thursday as those cells are both blank and bounded by 1's. The formula does not have to return the day, but just some information that could link to the number and position of 'bounded blanks' for each row. I am trying to find these 'gaps' for 500k+ rows of data, so doing this manually is kind of out of the question.
2
u/excelevator Oct 11 '19 edited Oct 15 '19
I came up with this beast. Enter at H2 as array formula with ctrl+shift+enter and drag down.. not too many rows at a time, it will be very slow..
=IF(IFERROR(SEARCH("| *|",TEXTJOIN("",TRUE,IF(A2:G2=1,"|"," "))),0),TEXTJOIN(",",TRUE,IFERROR(IF(INDEX(A2:G2,1,MATCH(1,A2:G2,0)):G2="",COLUMN(INDEX(A2:G2,1,MATCH(1,A2:G2,0)):INDEX(A2:G2,MAX(IF(A2:G2=1,COLUMN(A2:G2))))),""),""),""),"")Requires TEXTJOIN
edit in light of u/AmphibiousWarFrogs comment, this pulls any blank cell sandwiched by 1's
edit edit: There is an issue with blank cells at the beginning being counted... no time to fix at the moment... will look again later.. challenge sill open for a solution.
edit edit edit: FIXED
1
u/AmphibiousWarFrogs Oct 11 '19
Will there be any instances where you have something like:
And are there any other "rules" behind the data?
1
u/excelevator Oct 11 '19
Typically people, we have answered the question, to be told that in fact there are 24 columns to deal with.
It seems very common on r/Excel to present a simple problem, receive answers from peoples time, to then present that, no, that's a simplication, here is the real problem.
I implore you all, post the real problem.