Forum Discussion
krisplikj
Dec 29, 2022Copper Contributor
Dynamic Average based off the position of the first non-zero data point
Hello, This is piggy-backing off a previous question that was solved in finding the number of "leading zeroes" in monthly sales data. I am looking at the previous 24 months (columns a:x) and then c...
- Dec 30, 2022
krisplikj
Dec 30, 2022Copper Contributor
Thanks Pawn! This worked. An alternate solution provided which also worked was =AVERAGE(XLOOKUP(TRUE,A2:X2<>0,A2:X2,X2):X2)
Happy holidays to you and yours.
Happy holidays to you and yours.
OliverScheurich
Dec 30, 2022Gold Contributor
You are welcome. Instead of the long-winded formula i originally suggested for average one can apply this formula:
=AVERAGE(INDEX(A2:X2,,MATCH(1,--(A2:X2>0),0)):X2)
However since you have access to XLOOKUP the solution by Lorenzo is the best way for this.
Happy holidays to you and yours as well.