r/learnprogramming • u/ceristo • Oct 11 '19
Excel Formula Question
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.
| MONDAY | TUESDAY | WEDNESDAY | THURSDAY | FRIDAY |
|---|---|---|---|---|
| 1 | 1 | 1 | ||
| 1 | 1 | 1 | ||
| 1 | 1 | 1 | 1 | |
| 1 | 1 |
In the table above, this formula would return the days that are blank AND bounded by 1's. So for row 2&4, the formula would return a blank cell. However, for row 3, 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
View all comments
Show parent comment
1
u/random_passing_dude Oct 11 '19
ah alright, then you need to use vba, and loop on the row. from left to right, something like
this is just typed here, to give you an idea how it can be done more or less. i use an arraylist because i'm lazy and you need to resize array in VB. The idea of the code is to go from one side to the other, storing in "border" the cell with the last one found. when we find another one, then the cells between are the one we want.