cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
%3CLINGO-SUB%20id%3D%22lingo-sub-802838%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%E5%A6%82%E4%BD%95%E6%A0%B9%E6%93%9A%E5%88%97%E4%B8%AD%E5%80%BC%E4%B9%8B%E9%96%93%E7%9A%84%E5%B7%AE%E7%95%B0%E4%BE%86%E8%A8%88%E7%AE%97%E8%A1%8C%E6%95%B8%EF%BC%9F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-802838%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%3CP%3E%E4%BD%A0%E5%A5%BD%EF%BC%8C%3C%2FP%3E%3CP%3E%E6%88%91%E6%AD%A3%E5%9C%A8%E5%98%97%E8%A9%A6%E6%A0%B9%E6%93%9A%E2%80%9CDieY%E2%80%9D%E5%88%97%E5%89%B5%E5%BB%BA%E4%B8%80%E5%80%8B%E6%96%B0%E5%88%97%3C%2FP%3E%3CP%3E%E6%88%91%E6%83%B3%E8%A6%81%E6%A0%B9%E6%93%9A%E6%AF%8F%E4%B8%80%E8%A1%8C%E8%88%87%E5%89%8D%E4%B8%80%E8%A1%8C%E4%B9%8B%E9%96%93%E7%9A%84%E5%B7%AE%E7%95%B0%E9%80%B2%E8%A1%8C%E9%80%A3%E7%BA%8C%E8%A8%88%E6%95%B8%E3%80%82%3C%2FP%3E%3CP%3E%E7%AC%AC2%E8%A1%8C-%E7%AC%AC1%E8%A1%8C%EF%BC%8C%E7%AC%AC3%E8%A1%8C-%E7%AC%AC2%E8%A1%8C%EF%BC%8C%E7%AC%AC4%E8%A1%8C-%E7%AC%AC3%E8%A1%8C%EF%BC%8C%E4%BE%9D%E6%AD%A4%E9%A1%9E%E6%8E%A8%E3%80%82%3C%2FP%3E%3CP%3E%E5%A6%82%E6%9E%9C%E5%B7%AE%E5%80%BC%E4%BD%8E%E6%96%BC%E6%9F%90%E5%80%8B%E5%80%BC%EF%BC%88%E4%BE%8B%E5%A6%82%205%EF%BC%89%EF%BC%8C%E5%89%87%E5%B0%87%E8%A9%B2%E5%80%BC%E8%A8%AD%E7%82%BA%201%E3%80%82%3C%2FP%3E%3CP%3E%E5%A6%82%E6%9E%9C%E5%B7%AE%E5%80%BC%E5%A4%A7%E6%96%BC%E6%AD%A4%E5%80%BC%EF%BC%8C%E5%89%87%E8%A8%88%E6%95%B8%E5%8A%A0%201%E3%80%82%3C%2FP%3E%3CP%3E%E4%BF%9D%E7%95%99%E6%9C%80%E5%BE%8C%E7%9A%84%E8%A8%88%E6%95%B8%EF%BC%8C%E7%9B%B4%E5%88%B0%E5%B7%AE%E5%80%BC%E9%AB%98%E6%96%BC%E5%85%AC%E5%BC%8F%E4%B8%AD%E8%A8%AD%E5%AE%9A%E7%9A%84%E5%80%BC%E3%80%82%3C%2FP%3E%3CP%3E%E6%89%80%E4%BB%A5%E6%9C%80%E7%B5%82%E6%88%91%E5%B0%87%E6%9C%89%E4%B8%80%E5%80%8B%E6%96%B0%E5%88%97%EF%BC%8C%E5%85%B6%E5%80%BC%E5%A6%82%E4%B8%8B%EF%BC%9A1%2C1%2C1%2C1%2C1%2C1%2C1%2C2%2C2%2C2%2C2%2C2%2C2%2C2%2C3%2C3%2C3%2C3%2C3%20%2C3%2C3%20%E7%AD%89%E7%AD%89..%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CP%3E%E9%9D%9E%E5%B8%B8%E6%84%9F%E8%AC%9D%E4%BB%BB%E4%BD%95%E5%B9%AB%E5%8A%A9%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Ohad_s_0-1727735727384.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ohad_s_0-1727735727384.png%22%20style%3D%22width%3A%20363px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ohad_s_0-1727735727384.png%22%20style%3D%22width%3A%20363px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F68738i53F6878635D6D028%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Ohad_s_0-1727735727384.png%22%20alt%3D%22Ohad_s_0-1727735727384.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-802838%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%3CLINGO-LABEL%3E%E5%9F%BA%E7%A4%8E%E8%B3%87%E6%96%99%E5%88%86%E6%9E%90%E8%88%87%E5%BB%BA%E6%A8%A1%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3E%E8%B3%87%E6%96%99%E6%B7%B7%E5%90%88%E8%88%87%E6%B8%85%E7%90%86%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3E%E6%95%B8%E6%93%9A%E6%8E%A2%E7%B4%A2%E5%92%8C%E8%A6%96%E8%A6%BA%E5%8C%96%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-802896%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9B%9E%E8%A6%86%EF%BC%9A%E5%A6%82%E4%BD%95%E6%A0%B9%E6%93%9A%E5%88%97%E4%B8%AD%E4%BD%8D%E6%95%B8%E4%B9%8B%E9%96%93%E7%9A%84%E5%B7%AE%E7%95%B0%E4%BE%86%E8%A8%88%E7%AE%97%E8%A1%8C%E6%95%B8%EF%BC%9F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-802896%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E9%80%99%E6%98%AF%E6%88%91%E6%83%B3%E5%87%BA%E4%BE%86%E7%9A%84%E5%85%AC%E5%BC%8F%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EIf(%0A%09Row()%20%3D%3D%201%2C%20count%20%3D%201%2C%0A%09%3ADieY%20-%20Lag(%20%3ADieY%20)%20%26gt%3B%205%2C%20count%0A%09%2B%2B)%3B%0Acount%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22txnelson_0-1727770895361.png%22%20style%3D%22width%3A%20804px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1727770895361.png%22%20style%3D%22width%3A%20804px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F68742i8DBF7E42939E01E9%2Fimage-dimensions%2F804x547%3Fv%3Dv2%22%20width%3D%22804%22%20height%3D%22547%22%20role%3D%22button%22%20title%3D%22txnelson_0-1727770895361.png%22%20alt%3D%22txnelson_0-1727770895361.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%20%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
Ohad_s
Level III

How to Count rows based on difference between values in a column ?

Hi,

I am trying to create a new column based on column "DieY"

I want continuous count based on the difference between each row and the previous one.

row 2-row 1, row 3-row 2, row 4-row 3 and so on.

if the difference is below a certain value, e.g. 5, set the value to 1.

if the difference is above, add 1 to the count.

keep the last count until the difference is above the value set in the formula.

so eventually I will have a new column with values such as: 1,1,1,1,1,1,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3 and so on..

 

Many thanks to any help

 

Ohad_s_0-1727735727384.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to Count rows based on difference between values in a column ?

Here is the formula I came up with

If(
	Row() == 1, count = 1,
	:DieY - Lag( :DieY ) > 5, count
	++);
count;

txnelson_0-1727770895361.png

 

Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: How to Count rows based on difference between values in a column ?

Here is the formula I came up with

If(
	Row() == 1, count = 1,
	:DieY - Lag( :DieY ) > 5, count
	++);
count;

txnelson_0-1727770895361.png

 

Jim