Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9843

Increment value based on condition

$
0
0

I'm trying to combine arrayformula with an increment value based on a condition.

Basically I have a column called purpose, it basically has 2 values - Restock and Order. Upon order, column Count Order will display 1, otherwise, 0. On the column over, without arrayformula I'd add the row above with the value on the left, example

Purpose | Count Order | Increment
Restock | 0           | 0
Order   | 1           | 1
Restock | 0           | 1
Order   | 1           | 2

I'd normally use the code for C2=B2, then the subsequent line would be C3=B3+C2

With arrayformula, my formula that I came up with was

={"Increment"; arrayformula(if(A2:A="","", (B2:B)+(C1:C)))}

Which gives me a circular error. I'm guessing in part I'm trying to add the header which the only thing I can think of is have this array start on.

Is there a better way than to start lower with this formula?


Viewing all articles
Browse latest Browse all 9843

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>