# IF function syntax help [closed] 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"})

edit retag 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

Sort by » oldest newest most voted 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

more 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:
https://help.libreoffice.org/Calc/Log...
scrolling up and down you see more about logical functions

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 - I think @CEAuke gave you a now matching answer.