I want to search upwards in a column to find the last value not equal to a value (0,"", etc) so that I can perform a calculation using that value. Here is an example of the sheet.

A B
1 21 21
2 17 38
3 21 59
4 21 80
5 0
6 4 84
7 4 84
8 0
9 4 84

working my way down the column, what I want to do is take a value in column B and add it to the value in column A if the value in A is not 0. The first value in B will always equal the value in A if that value is not 0. If the search upwards shows only null fields or it hits the first row in the column without finding a value, that value in the current B cell should show the value in column A. I want the field to show null if A is 0. I want a formula that will look upwards in the column to find the last non-null value to add my value in column A. example : formula in B5 should show a null (""), the formula in B6 should show 84 (B4+A6), the formula in B7 should show 88 (B6+A7), formula in B8 should show null (""), etc. Column A will change values from time to time and I would like the formula to automatically be able to handle the change in values. Complex enough? I hope that this is clear for you. Thank you.

John