Ask Your Question

IF function syntax help [closed]

asked 2014-05-19 08:54:36 +0200

Aljos@ gravatar image

updated 2015-10-26 22:01:38 +0200

Alex Kemp gravatar image

Hi, I need help translating this bit of code into a IF function:

int time=1034; int test=2000; int count=0; string conf="A change has happened";

if(time!=test) { count++; test=time; cout << conf; }

so basically what I would like to do is to change values of multiple cells depending on a result of the IF function.

Something like this: IF(NOT(A1=B1),{C1=C1+1;A1=B1;D1="A change has happened"})

Thanks everybody for your help.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-23 02:07:32.187296

2 Answers

Sort by » oldest newest most voted

answered 2014-05-19 09:53:32 +0200

CEAuke gravatar image

Any expression in calc returns a value only to that cell where the expression is written. If you want to have dynamic content in cell A1, then you need an expression / function in A1. You cannot use an ordinary function to modify another cell. To get around this: 1. You can either chain multiple cells. E.g. in cell D1, you put your function with some basic if logic. And then in cell A1, you have another function to do the increment. 2. Write a macro to do it all. If logic + update multiple cells

edit flag offensive delete link more

answered 2014-05-19 09:03:44 +0200

ROSt52 gravatar image

I am not sure what you want to achieve with

IF(NOT(A1=B1),{C1=C1+1;A1=B1;D1="A change has happened"})

To me it seems that you have to many arguments in your if-function. The synthax is:

IF(Test; ThenValue; OtherwiseValue)

for more details see:
scrolling up and down you see more about logical functions

edit flag offensive delete link more


i would like to the ThenValue part of the function to do this 3 things:

  1. increase the value of C1 by 1
  2. assign the value of A1 to B1
  3. put the text into D1
Aljos@ gravatar imageAljos@ ( 2014-05-19 09:09:19 +0200 )edit

@Aljos - I think @CEAuke gave you a now matching answer.

ROSt52 gravatar imageROSt52 ( 2014-05-19 15:46:32 +0200 )edit

Question Tools

1 follower


Asked: 2014-05-19 08:54:36 +0200

Seen: 3,017 times

Last updated: May 19 '14