Which formula to use

AndrePrevin

New Member
Joined
Jan 13, 2019
Messages
8
Hi all

I have 3 columns of data. In the first and second columns I have a series of values and in the third column I need to use a formula which looks at the second column to see if there's any non-zero positive number there.
If there is then it must use that number and it must thereafter look at the first row and add that value to the number it took from the second row.
it must keep adding the value from the first row to the first non-zero positive number from the second row and incrementing upwards by the value in the first row.
Where it gets tricky, if it encounters a second non-zero positive number in the second row, it must then discard whatever value it has accumulated in the cell above it, and then reset the output value in column 3 to the new non-zero positive number it has encountered in the second row.
And thereafter use this new number and add it to the in-line value from the first column and keep incrementing upwards until it encounters another non-zero positive number in column 2

Sorry for the overly elaborate description
I have attached a sample below which actually explains/illustrates my problem a lot more simply

[TABLE="width: 308"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Metal produced[/TD]
[TD]Sounding bar[/TD]
[TD]Corrected values[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]2[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]0[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]0[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]0[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]0[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]4[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]0[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]0[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]6[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]0[/TD]
[TD]11[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]0[/TD]
[TD]12[/TD]
[/TR]
</tbody>[/TABLE]


Please kindly assist me

Thank you gratefully
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Replace corrected values "C2" with this =IF(B2>0,B2,A2+C1) and fill down.

This checks column 2 for values > 0, if found only returns the value of column 2, otherwise adds column 1 to the previous column 3 value row above. Provides the same column 3 results as your example when filled down in column 3.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top