Compute New Variable based on another variable

#1
Hi All,

I'm struggling to work out the right functions to use in compute variable to create a new variable. I hope you will be able to help me as I cannot process this in Excel as my data file is too large.

I am trying to create a new variable based on how another variable changes.

The data is related to how often a window open and closes throughout the day. As an example, I have the following data and I want to create the column in red as my new variable in SPSS.

Example.png

Any thoughts of how to do this would be much appreciated as I am fairly new to SPSS.

Thanks all,

Zoe