I need to search diagonally and return the cell count until the first blank cell is reached. The following formula works perfect for doing this function in a contiguous row left to right: =MATCH(1,--(A1:AB1=""),0)-0).
I use this formula to search right to left in a contiguous row: =MAX(IF(LEN(A1:AB1)<>-1,COLUMN(A1:AB1)))-MAX(IF(LEN(A1:AB1)=0,COLUMN(A1:AB1)-1))
My problem is coming up with a similar function that will do this with diagonal, non-contiguous cells (and also from right to left). I need to search down to the left corner of a range and also separately search down to the right corner of a range (two different
formulas). For example, in the table below, if I started counting down to the left from cell C1 the return should be 2 (counting cells B2, A3, with A3 being the first blank cell) . If I started counting from cell C1 down to the right the return should be 3
(counting cells D2, E3, F4, with F4 being the first blank cell) .
I will put these formulas in columns far to the right of the table and copy the formula down to get the same results for C2, C3, C4, & D2, D3, D4, & E2, E3, E4, etc.. I will have enough blank columns to prevent the formula from becoming a circular reference.
|
A |
B |
C |
D |
E |
F |
| 1 |
|
21 |
11 |
|
25 |
2 |
| 2 |
44 |
19 |
15 |
32 |
16 |
9 |
| 3 |
|
7 |
22 |
2 |
13 |
16 |
| 4 |
5 |
11 |
8 |
17 |
10 |
|
| 5 |
26 |
|
19 |
|
4 |
6 |
My spreadsheet is around 60 columns by 200 rows and need to have a formula that can be copied and dragged. I know very little VBA, so a formula is what I am looking for, but will use VBA if it can be easily explained.
I have spent hours, days really, looking for a solution. Any help would be immensely appreciated. Thanks
*Note: I also posted this question here. I will post the solution to both forums when it is reached.