Community Trekker

Joined:

Apr 28, 2015

## Counting formula to identify different groups in timed data

I have timed data (Turn-up Time) I used to create a Time Differnce column to easily identify different run sequences.  What I am struggling with is how to use this to creat a new column (Run Number) that automatically groups the data.  Ideas?

1 ACCEPTED SOLUTION

Accepted Solutions

Super User

Joined:

Jun 22, 2012

Solution

## Re: Counting formula to identify different groups in timed data

This script should do the trick:

``````Names Default To Here( 1 );
dt = Current Data Table();

dt << New Column( "Run Number",
character,
formula(
If( Row() == 1, runnum = 1 );
If( :Time Difference Min > Col Mean( :Time Difference Min ) + Col Std Dev( :Time Difference Min ),
runnum = runnum + 1
);
runnum;
)
);``````
Jim
2 REPLIES

Super User

Joined:

Jun 22, 2012

Solution

## Re: Counting formula to identify different groups in timed data

This script should do the trick:

``````Names Default To Here( 1 );
dt = Current Data Table();

dt << New Column( "Run Number",
character,
formula(
If( Row() == 1, runnum = 1 );
If( :Time Difference Min > Col Mean( :Time Difference Min ) + Col Std Dev( :Time Difference Min ),
runnum = runnum + 1
);
runnum;
)
);``````
Jim

Community Trekker

Joined:

Apr 28, 2015

## Re: Counting formula to identify different groups in timed data

Jim,  works perfectly, many thanks!!