I need a functional formula for OpenOffice Calc that will function like this...
if N3 = "Optics" then "Tactical" or if N3 = "Flashlight" then "Matches"
Basically I need multiple if then statements in one cell so that it can return multiple potential results based on whatever word is placed in there. I spent 2 hours looking but found nothing.
Please please help!
[Solved] Help with IF THEN OR Statement in Calc
[Solved] Help with IF THEN OR Statement in Calc
Last edited by bradyso on Thu Mar 07, 2013 7:57 am, edited 1 time in total.
OpenOffice 3.4.1 on Windows 7
Re: Please Help with IF THEN OR Statement in Calc?
I wouldn't us an If Then formula. Try a VLOOKUP(). For the example you give you would need to use two columns in any convenient spot on your sheet. Let's say columns Y and Z. In Y1 write Optics, in Z1 Tactical, in Y2 Flashlight and in Z2 Matches. You formula would then be
It will look in cells Y1 and Y2 for an exact match to the contents of N3 and return the corresponding value in column Z. You can see that this can be expanded to many matched pairs easily, while nested IF() statements become unwieldy very quickly.
Code: Select all
=VLOOKUP(N3;Y1:Z2;2;0)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: Please Help with IF THEN OR Statement in Calc?
Oh ok, that seems to work pretty well so far. But what do I do if the list is really long? For instance in your scenario, I need to put 50 items in column Y, and get a different return for their counterpart to the right in column Z?
OpenOffice 3.4.1 on Windows 7
Re: Please Help with IF THEN OR Statement in Calc?
Sorry, I'm not seeing the problem there.
VLOOKUP will handle hundreds of items in the table; it's much simpler than a single formula with hundreds of IF statements, no?
VLOOKUP will handle hundreds of items in the table; it's much simpler than a single formula with hundreds of IF statements, no?
AOO4/LO5 • Linux • Fedora 23
Re: Please Help with IF THEN OR Statement in Calc?
Yes you're right it most certainly is. But when I put something in N23 for instance, can Vlookup reference the list in column Y and insert the corresponding word to the right in column Z and place it in column O?
For instance, I want to paste a massive list into column N, and Vlookup looks for a match anywhere in column Y, and finds the correct counterpart in column Z and pastes it in column O.
Right now when I do that, it just says #N/A. I don't think I did a good job of describing what I'm trying to do...
For instance, I want to paste a massive list into column N, and Vlookup looks for a match anywhere in column Y, and finds the correct counterpart in column Z and pastes it in column O.
Right now when I do that, it just says #N/A. I don't think I did a good job of describing what I'm trying to do...
OpenOffice 3.4.1 on Windows 7
- MrProgrammer
- Moderator
- Posts: 5477
- Joined: Fri Jun 04, 2010 7:57 pm
- Location: Wisconsin, USA
Re: Please Help with IF THEN OR Statement in Calc?
Hi, and welcome to the forum.
Read the entire tutorial, but for unexpected #N/A, see Q5, Q6, Q11, Q13, Q14, Q16, Q17, and especially Q19.
If this answered your question please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.
IF() is a function, not a statement. There are no statements in spreadsheet formulas.bradyso wrote:I need multiple if then statements …
Yes, that's exactly what VLOOKUP does when you use it in column O.bradyso wrote:But when I put something in N23 for instance, can Vlookup reference the list in column Y and insert the corresponding word to the right in column Z and place it in column O?
[Tutorial] VLOOKUP questions and answersbradyso wrote:Right now when I do that, it just says #N/A.
Read the entire tutorial, but for unexpected #N/A, see Q5, Q6, Q11, Q13, Q14, Q16, Q17, and especially Q19.
If this answered your question please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.
Last edited by MrProgrammer on Wed Mar 06, 2013 10:32 pm, edited 3 times in total.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.8, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
AOO 4.1.7 Build 9800, MacOS 13.7.8, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
Re: Please Help with IF THEN OR Statement in Calc?
Put this into a cell, say X3: =VLOOKUP($N3;$Y$1:$Z$2;2;0)
Copy the cell.
Select the target range, say X4:X9999
Paste.
Copy the cell.
Select the target range, say X4:X9999
Paste.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Please Help with IF THEN OR Statement in Calc?
Solved, thanks guys I appreciate it.
OpenOffice 3.4.1 on Windows 7