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
 All Forums
 Origin Forum
 Origin Forum
 Conditional operator for Set column values

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Jon-in-Germany Posted - 08/23/2013 : 05:35:55 AM
Origin Ver. OriginPro 9.0. and Service Release (Select Help-->About Origin):
Operating System: W7

Hello,

I want to use "Set column values" to output values in a column that are conditional to values in two other columns.

In Col(A) I have integer values ranging from 1-10 and in Col(B) the same (but not identically ordered).
In Col(C) I have a range of values (let's say, random numbers).

Now, I would like to output the values of Col(C) to a new column, Col(D), according to specific values in Col(A) and Col(B).

For example, if Col(A)=2 and Col(B)=5, then Col(D)=Col(C).

If these conditions are not met, individual rows of Col(D) should be left blank.

I know that it is a simple operation, but I am not familiar with the conditional operators in Origin and can't get anything I try to work.

Any suggestions would be very much appreciated.

Thanks
Jon
2   L A T E S T    R E P L I E S    (Newest First)
Jon-in-Germany Posted - 08/23/2013 : 07:59:05 AM
Hideo, you are a lifesaver, thank-you. It works just how I wanted it to.

Thanks again.
Jon
Hideo Fujii Posted - 08/23/2013 : 07:42:47 AM
Hi Jon,

The conditional operator has the following syntax:
  <Condition>?<True>:<False>
thus, you can write the formula like this:
  (Col(A)==2 && Col(B)==5)?Col(C):1/0
Worked?

--Hideo Fujii
OriginLab

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000