cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
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

Recommended Articles