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
 sumif function in origin?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Matzemas

2 Posts

Posted - 12/10/2012 :  07:12:19 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,

I'm new to Origin and now I have a Problem.
I'm searching for a function similar to the sumif function in Excel.
How can I realise this in Origin?

Thank you for your help!

Regards,
Matthias

Hideo Fujii

USA
1582 Posts

Posted - 12/10/2012 :  1:30:49 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Matthias,

Excel is cell-based, so the function generally returns a single value; However, Origin is
vector(i.e. column/dataset)-based, so it typically gives the result as a vector. Having this basic
conceptual difference in mind, you can consider the following approaches, corresponding an Excel formula like:
sumifF(A2:A25,"<=0.5")

Method-1) Use a "filter"; then use the "Set Column Values" tool:

You can set a column filter, and apply the sum command in the Set Column Values tool. This method is intuitive, but it gives the only conditional sum from row=1 to the last row.




Method-2) Use nested conditional operators in the "Set Column Values" tool:

You can set the formula which contains the conditional operators in the Set Column Values tool such as:
i==1?(col(A)[1]<=0.5?col(A)[1]:0):(col(A)[i]<=0.5?col(B)[i-1]+col(A)[i]:col(B)[i-1])
The syntax of the conditional operator is:
<condition> ? <valueOnTrue> : <valueOnFalse>
Here, "i" refers to the index (i.e., row#).


The advantage of this method is that it gives the conditional sum up to every row from row=1.

In either way above, you can set the Recalculation mode of the Set Column Values tool to "Auto"
if you dynamically update the summation when the source data get changed.

Hope this helps.

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 12/10/2012 3:08:59 PM
Go to Top of Page

Matzemas

2 Posts

Posted - 12/13/2012 :  03:25:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello Hideo,

thank you for your Help. I understand your solution.
I think that solving my problem is possible with your solution although it is quite complicated. Maybe there is a better way? I try to explain my Problem a little bit further:

I have an ammount of entities with different parameters. I want to sum up one parameter
in condition of another one which is for example an orientation angle. The entities can have orientation angles in a range of -5:5 degree in 0.1 degree steps. I want to sum up all entities that have the same orientation angle.

Using your solution I'd need a row for every angle. What I am looking for is a way to get a column with the orientation angles and a column with the values for every orientation angle. Do you think there is a simple solution to that kind of problem?

Regards,
Matthias
Go to Top of Page

easwar

USA
1964 Posts

Posted - 12/13/2012 :  12:04:51 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
HI Matthias,

So your orientation column has unique values (such as -5.0, -4.9 etc) but there could be multiple entries for same value (such as -4.8 appears many times), and then you want the entity values in the second column summed up for each unique orientation value.

Is the above correct? If yes, you can use Statistics->Descriptive Statistics->Statistics on Columns, expand the Range1 node in the dialog, assign the entity column to Data Range, and the Orientation column to Grouping range....and then the output will have the entities summed up for each unique value from the orientation column. You can turn off all stats other than Sum.

If this is not what you want, can you send us your worksheet/project? Use the "Send file to tech support" link on to right of this page, and refer to this post in your e-mail.

Easwar
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