BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
UberBock

Occasional Contributor

Joined:

Jan 11, 2019

Counting...

So I have a column like this (it is character) and I would like to create a way to add a countup of the times it occurs.  The data will be sorted by another column which is test date/time so that I can later see if the 1st or 2nd or 3rd etc...time in the Aliquot are different than the 4th or 5 etc....so how to count sequentially based on the AliquotID

AliquotID   New Column

11172            1
11172           2
11172           3
11172          4
11172         5
11172         6
11173         1
11173         2
11173         3
11173        4
11173         5
11173         6
11174         1
11174         2
11174         3
11174
11174
11174
11175
11175
11175
11175
11175
11175
11176
11176
11176
11176
11176
11176

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Re: Counting...

try this formula

If( Lag( :AliquotID ) != :AliquotID,
	x = 1,
	x = x + 1
);
x;
Jim
4 REPLIES 4
markbailey

Staff

Joined:

Jun 23, 2011

Re: Counting...

Sort by AliquotID and Date. Then run this script:

 

Current Data Table() << New Column( "Replicate", "Numeric", "Ordinal",
	Formula( If( Row() == 1, 1, :AliquotID == Lag( :AliquotID ), Lag( :Replicate ), Lag( :Replicate ) + 1 )
);

 

 

Learn it once, use it forever!
markbailey

Staff

Joined:

Jun 23, 2011

Re: Counting...

This kind of question has been asked and solved before.

Learn it once, use it forever!
Highlighted
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Re: Counting...

try this formula

If( Lag( :AliquotID ) != :AliquotID,
	x = 1,
	x = x + 1
);
x;
Jim
UberBock

Occasional Contributor

Joined:

Jan 11, 2019

Re: Counting...

Thank you so much!