cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
AC_AC
Level I

How to apply a column formula on only a range of rows and not every row?

Hi,

 

I am trying to create a column formula that calculates the mean of every 5 rows (for a specific column). 

Normally the formula are applied to every row using values in such row. Instead, I would like to use values from 5 previous row to calculate a mean value.

I am been playing with the formula editor and try to use the Row() and other functions, but without success. 

 

Thanks a lot to anyone who can help me out.

 

BR

AC_AC

 

Mean5RowProblem.png

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to apply a column formula on only a range of rows and not every row?

For Mean I would suggest using Col Moving Average

If(Modulo(Row(), 3) == 0,
	Col Moving Average(:Col, 1, 2, 0),
	.
)

jthi_0-1657882865907.png

Otherwise Data table subscripting might be helpful

If(Modulo(Row(), 3) == 0,
	Mean(:Col[Index(Row() - 2, Row())])
)
-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: How to apply a column formula on only a range of rows and not every row?

For Mean I would suggest using Col Moving Average

If(Modulo(Row(), 3) == 0,
	Col Moving Average(:Col, 1, 2, 0),
	.
)

jthi_0-1657882865907.png

Otherwise Data table subscripting might be helpful

If(Modulo(Row(), 3) == 0,
	Mean(:Col[Index(Row() - 2, Row())])
)
-Jarmo