Okay, I have something that, in VB or C++ would be easy... somehow, I cannot get it in Calc...
I have two cells. A1 and B1, lets say. Based on the input of A1, I want the value of B1 to change... Here's an example.
A1 = Input
B1 = Value
IF A1="3.75" THEN B1 = "1/4"
ELSE
IF A1 = "6.00" THEN B1 = "3/8"
And so on... making a sheet that calculates thickness of material based on material cost, or I can even do it the other way where the material thickness is entered and the cost is calculated. Would like a drop down or something even to make it easier...
IF/THEN/ELSE Statements in Calc
IF/THEN/ELSE Statements in Calc
OpenOffice 3.3 on Windows 8
Re: IF/THEN/ELSE Statements in Calc
The form of the IF() function is
so in you case B1 would contain
However, I wouldn't use nested IF() functions to do this. After a few levels the function gets unwieldy. Try a VLOOKUP(). In some convenient place, say E1:F2 make a table
In B1 you enter
The function will look for an exact match of A1 in column E and return the matching value from column F.
Also, you have written your question as if 3.75, 1/4 etc. are text. If you are actually trying to match numeric values, don't put them in quotes.
Code: Select all
=IF(Condition;ThenDoThis;ElseThis)Code: Select all
=IF(A1="3.75";"1/4";IF(A1="6.00","3/8";"No Match"))Code: Select all
3.75 1/4
6.00 3/8Code: Select all
=VLOOKUP(A1;E1:F2;2;0)Also, you have written your question as if 3.75, 1/4 etc. are text. If you are actually trying to match numeric values, don't put them in quotes.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Re: IF/THEN/ELSE Statements in Calc
I also have a problem with an IF formula.
What I want is the following:
=IF((D40="");"";(IF(B40=D40)~5+B40*2~ABS((B40-D40)*(-2)))) -> Returns in "Err:502"
So what I want is if D40 is empty, write nothing, otherwise IF B40 and D40 are the same make 5+2*B40 and if this is also not true (not empty and also not the same) do ABS((B40-D40)*(-2)).
So there are three different version possible: 1. Fields are empty, 2. fields not empty but are the same and 3. fields are not empty and not the same.
It works when I combine two of these but it does not work with all three.
Someone knows why? What am I doing wrong?
What I want is the following:
=IF((D40="");"";(IF(B40=D40)~5+B40*2~ABS((B40-D40)*(-2)))) -> Returns in "Err:502"
So what I want is if D40 is empty, write nothing, otherwise IF B40 and D40 are the same make 5+2*B40 and if this is also not true (not empty and also not the same) do ABS((B40-D40)*(-2)).
So there are three different version possible: 1. Fields are empty, 2. fields not empty but are the same and 3. fields are not empty and not the same.
It works when I combine two of these but it does not work with all three.
Someone knows why? What am I doing wrong?
MaxOS X El Capitan 10.11.3
Open Office 4.1.2
Open Office 4.1.2
Re: IF/THEN/ELSE Statements in Calc
This formula works for me fine:
Code: Select all
=IF(D40="";"";IF(B40=D40;5+B40*2;ABS((B40-D40)*(-2))))Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: IF/THEN/ELSE Statements in Calc
Yeah I tried again, works now for me too! Don't know what I made different. Thanks for your fast reply!
MaxOS X El Capitan 10.11.3
Open Office 4.1.2
Open Office 4.1.2
Re: IF/THEN/ELSE Statements in Calc
You originally enteredoo_usr wrote:Yeah I tried again, works now for me too! Don't know what I made different. Thanks for your fast reply!
Code: Select all
=IF((D40="");"";(IF(B40=D40);5+B40*2;ABS((B40-D40)*(-2))))Code: Select all
IF(B40=D40)(The specifications allow for shortened IF expressions where the third or both the third and the second parameters are missing. If a missing parameter has to evaluate it will return the logical value of the condition. I personally do not judge this reasonable.)
On Windows 10: LibreOffice 25.8.4 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
---
Lupp from München