Discussions
Categories
Groups
Help
Home
User Community
Discussions
Accumulate column data
terapin
How do I use the lag operator to add up data on a row wise basis? That is, I want to accumulate data from column tair in a new column called chilling degree if the tair value is > 5.
tair chilling degree
5 5
7 5
5 10
Accepted answers
All comments
afterword
I don't know the answer to this question, but it sounds like you're working with building energy data. Am I right? That's my field as well so I'd be happy to trade scripts and files with you.
unknown
If you want to simply accumulate values in a column, you don't necessarily need the lag operator. If you want to accumulate data (get a cumulative sum) for a column called "tair", do the following:
1. Create a new column. In this example, I call it "total".
2. Put the following formula in the new column:
(ignore this line)
The formula takes the value of tair in the current row, and adds it to the previous value of total, thus creating a cumulative sum.
If you only want to accumulate the values if they are greater than or equal to 5, then use the formula:
(ignore this line)
The formula looks at the current value of tair, and if it is less than 5, instead of adding tair, it adds 0.
Quick Links
All Categories
Recent Posts
Activity
Unanswered
Groups
Help
Best Of