cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
hcarr01
Level VI

Additionner des cellules

Bonjour, comment je pourrais faire pour : sur une colonne additionner les valeurs lorsque les termes consécutifs sont égaux et laisser les valeurs initiales lorsque les termes consécutifs sont différents ?

Ex:

 

hcarr01_1-1679296450498.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Additionner des cellules

Not exactly sure how you would like your data to look, but using Dif (or Lag) in formula should work

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(7),
	Compress File When Saved(1),
	New Column("Column 1",
		Numeric,
		"Continuous",
		Format("Best", 12),
		Set Values([1, 1, 2, 3, 4, 4, 4, 5])
	)
);

dt << New Column("Col", Numeric, Continuous, Formula(
	As Constant(val = :Column 1);
	If(Dif(:Column 1) == 0,
		val += :Column 1
	,
		val = :Column 1;
	);
	val;
));
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Additionner des cellules

Not exactly sure how you would like your data to look, but using Dif (or Lag) in formula should work

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(7),
	Compress File When Saved(1),
	New Column("Column 1",
		Numeric,
		"Continuous",
		Format("Best", 12),
		Set Values([1, 1, 2, 3, 4, 4, 4, 5])
	)
);

dt << New Column("Col", Numeric, Continuous, Formula(
	As Constant(val = :Column 1);
	If(Dif(:Column 1) == 0,
		val += :Column 1
	,
		val = :Column 1;
	);
	val;
));
-Jarmo
hcarr01
Level VI

Re: Additionner des cellules

 

Merci pour votre réponse @jthi !