Looking uprange for next nonblank cell

B

Brent E

Good day everybody,

I am looking for a formula to search the column above for next nonblank cell
doing up.

Explanation:
I have a list of integers in column E. They are broken out between sections
of blank rows for readability. I am trying to figure out a formula that will
allow additional cells to be added to each section, and have the next section
dynamically adjust reference to the last non blank cell in preceding section
above.

For example:
For ease of reference:
data in section 1 of Col E. (we'll call this section "Programs"):
1
2
3

Section 2 in ColE (we'll call this "Products"):
4
5

I would like to enter a formula to perform:
If above cell is blank, search column going up for the next nonblank cell.
Then once the nonblank cell is identified, the value in the cell below will
equal the value above + 1.

Pseudo code would be something like:
If E9 location-1 (e.g. cell above) = not blank, then E9=E8 +1,
Else search range upwards for next nonblank cell
Value of current cell below= value of next upwards non blank cell + 1

Note: All the cells in the column are currently set to adjust their values
based on the preceding cell:
current cell = preceding cell + 1, except if blank.

Example of Application:
This formula would provide so that If I insert a row in the "Programs"
section and enter a 4 under existing data 3, than the 4 in the people section
will automatically test for the next nonblank cell above and adjust to 5, and
in turn will cause the current 5 to adjust up also.

Thanks for your assistance
Cordially,
 
S

Sheeloo

I think you want consecutive numbers skipping blank rows
Then in E1 enter 1
in E2 enter (assuming Col B is the col you are testing for non-blank values)

=(IF(ISBLANK(B2),"",MAX($A$1:A1)+1))

and copy down
 
S

Sheeloo

If you just want to retain the sequence after you insert a blank row then
enter 1
in E1 and the following in E2 and copy down;
=(IF(ISBLANK(A1),"",MAX($A$1:A1)+1))

After this you can insert blank rows and the numbers will adjust.
 
B

Brent E

Thanks Sheelo,

That looks like may work, I think we are getting close. I pasted that, but
is just sequencing all the cells whether blank or not.

I am also curious, why the A1 and $A:$1 references? We want to test for
blanks in the range of Col E. Shouldn't I change the A's to E's? Or if u
prefer, the first integer entry is technically on row 11 so the sequence
range begins on row 11, but I don't know if that is pertinent.

Thanks
 
B

Brent E

Actually, I made a slight modification and it worked great. Ranger starts in
Cell E11, I put 0 in E11 and E12 entered:
=(IF(ISBLANK(B12),"",MAX(E1:E11)+1)) and filled down.

The sequence is continuing properly. Thanks Much.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top