The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Sum up several values in one coloumn
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

islan

Switzerland
6 Posts

Posted - 11/07/2013 :  06:25:32 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 5.1.5 G
Operating System: Windows 7, 64-bit

Hello together

I am new to Orgin and I would like to sum up the values highlighted in the graph.


How can I tell Origin that it has to check if the value in the coloumn is positive and if so that Origin shall built the sum of all positive values in that coloumn?

Thanks

Ursina

Hideo Fujii

USA
1582 Posts

Posted - 11/07/2013 :  2:52:32 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Ursina,

The sum value of the highlighted cells is always shown in the status bar at the bottom of the Origin window.
If you want to put a condition, only when all cells are positive, you can run the following 4-line script in the Script window;
range rr=wcol(wks.c1)[wks.r1:wks.r2];
sum(rr);
if(sum.min>0) type All cells are positive (or missing). Sum is $(sum.total);
else type Some are negative or zero;
This works as you wanted?

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 11/07/2013 3:03:07 PM
Go to Top of Page

lkb0221

China
497 Posts

Posted - 11/07/2013 :  3:17:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Ursina,

You can try the following script:

range rr = !A3[13:32]; //Specify the data range you want to sum
double ss=0;
loop (ii, 1, rr.getsize())
{
If (rr[ii]>0) // If data is positive, add to the sum
{
ss = ss + rr[ii];
}
}
ss=; // Show the result in script window
Go to Top of Page

lkb0221

China
497 Posts

Posted - 11/15/2013 :  4:32:34 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Ursina,

If you don't want use script window, you can also implement this by set column values.
Assume you have data in Col(A) and want put sum into col(D), see the screenshot below:



Hope this will help.

Zheng
OriginLab
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000