SOLVED

Reset the Scan function with a condition.

Steel Contributor

Hi,

 

I am playing with the Scan function. The goal is to "reset" sum at rolling months, of my choice.

 

The problem is in this function: =SCAN(0;t_salg[Beløp];LAMBDA(a;b;IF(K3#<>M2;a+b;0*a+b)))

 

I guess the problem is the K3# dynamic refference. 

 

Is it possible? Please see the attached document as an example.

 

Best Regards

Geir

 

3 Replies
best response confirmed by Geir Hogstad (Steel Contributor)
Solution

@Geir Hogstad 

Perhaps this:

=SCAN(0,t_salg[Beløp],LAMBDA(a,v,LET(k,SEQUENCE(ROWS(t_salg)/3,,3,3),IF(XOR(ROW(v)=k),v,a+v))))
Perfect. Thank you.
You're welcome!
1 best response

Accepted Solutions
best response confirmed by Geir Hogstad (Steel Contributor)
Solution

@Geir Hogstad 

Perhaps this:

=SCAN(0,t_salg[Beløp],LAMBDA(a,v,LET(k,SEQUENCE(ROWS(t_salg)/3,,3,3),IF(XOR(ROW(v)=k),v,a+v))))

View solution in original post