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
 How to use IF and OR together
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

sivanml

1 Posts

Posted - 08/04/2015 :  01:07:34 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,
I have a data set in columns (say) A, B, C. I want to perform a calculation such that if the data in either of col(A) or col(B) is negative, then multiply the data in col(c) by (-1). Otherwise read the col(c) data as it is. The result is required in another col (D). How do I go about it in Orgin 8?

Siva

jasonzhao

China
262 Posts

Posted - 08/04/2015 :  02:30:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

Please right click the column D and select Set Column Values to open the Set Values dialog, then use the formula below, click OK to apply:


((col(A)>0)&&(col(B)>0))?col(C):-col(C)



Best regards!
Jason
OriginLab Technical Service
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 08/04/2015 :  12:09:44 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Siva,

Just a minor correction, it should be:
((col(A)>=0)&&(col(B)>=0))?col(C):-col(C)
or, followed your original logical formulation, the conditional formula may be:
((col(A)<0)||(col(B)<0))?-col(C):col(C)

--Hideo Fujii
OriginLab

P.S. With no logical operator, try
2*(sign((sign(col(A))+1))*sign((sign(col(B))+1))-0.5)*col(C)
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