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 for Programming
 LabTalk Forum
 Missing Values makes calculation wrong
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

JThieser

16 Posts

Posted - 07/12/2012 :  12:16:04 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System:
Hey,
when i multiply several coloums to a new colunm i have the problem that when in one of these colunms are missing values the calculation doesn't work...
How is it possible that in this case Origin just neglect this missing value??

Thanks a lot

Jim

Penn

China
644 Posts

Posted - 07/15/2012 :  11:08:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Jim,

I am afraid that it cannot just multiply the columns directly. You can refer to the following script, which can be put into the Before Formula Scripts panel in the Set Value dialog. This script will get the result row by row after checking the missing values.

range aa = 1;  // column 1
range bb = 2;  // column 2
range cc = 3;  // column 3
range dd = 4;  // column 4
for(ii=1; ii<=wks.nrows; ii++)
{
	double aa1 = aa[ii]==1/0?1:aa[ii];  // if missing, consider as 1
	double bb1 = bb[ii]==1/0?1:bb[ii];
	double cc1 = cc[ii]==1/0?1:cc[ii];
	if(aa[ii]==1/0 && bb[ii]==1/0 && cc[ii]==1/0)  // if all are missing values
		dd[ii] = 1/0;  // result is missing value
	else
		dd[ii] = aa1*bb1*cc1;  // multiply
}



Penn
Go to Top of Page

JThieser

16 Posts

Posted - 07/16/2012 :  04:24:39 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks!!!
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