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
 Problem with "IF" function in column formula
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Sabin1989

United Kingdom
5 Posts

Posted - 11/26/2018 :  11:56:19 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi all!

I have a simple workbook of the form:

Col(A) Col(B) Col(C) Col(D)
0 0 0
0.5 0 0.5
1 0 0

This keeps going on, but the rest is irrelevant for my question.
Basically, I would like Col(D) to have the values of Col(A), but only IF Col(C)==0.
So I made a simple formula as: C==0?A:""

For reasons I cannot comprehend, Origin then only calculates this for the very first row.
Basically, as soon as a non-0 value is found in the second row, where Col(C) is 0.5, everything else remains blank.
How can I avoid this?

So basically I should get:

Col(A) Col(B) Col(C) Col(D)
0 0 0 0
0.5 0 0.5
1 0 0 1

Many thanks!
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 2018b b9.5.5.409
Operating System: Windows 10

yuki_wu

896 Posts

Posted - 11/27/2018 :  01:38:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I am sorry that this is a bug and we have added it to our bug tracking database (ID: ORG-19433). In fact, it works fine if we change “” (string) to 0 (numeric), like C==0?A:0.

You could use Set Values dialog either:
1. Select column and right click to select Set Columns Values
2. Enter the following script in Before Formula Script box:

string temp$="";

3. Enter

C==0?A:%(temp$)

in Col(D)= box

4. Click OK button.


Regards,
Yuki

OriginLab

Edited by - yuki_wu on 11/27/2018 02:14:20 AM
Go to Top of Page

yuki_wu

896 Posts

Posted - 11/27/2018 :  02:01:02 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

If you are using Origin 2019, you could type in function row directly:

if(C=0, A)

If you are using older version, you can type the following without "" after :

C==0?A:


Regards,
Yuki

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