[Solved] Need formula which uses IF with AND/OR

Discuss the spreadsheet application
Post Reply
karyma
Posts: 1
Joined: Tue Sep 07, 2021 1:39 pm

[Solved] Need formula which uses IF with AND/OR

Post by karyma »

How to make function

If a1+a2 =2 or a1+a2 = 4 show 2
Else show 1
Functions IF and OR return only True or false

and next

If a3 =1 and a4=2 and a5=2 and a6= 1 Show "black"

etc
Last edited by MrProgrammer on Thu Nov 18, 2021 1:53 am, edited 1 time in total.
Reason: Tagged ✓ [Solved]
OpenOffice 2.4
Matareuz
Posts: 23
Joined: Fri Nov 20, 2020 4:33 pm
Location: Venezuela

Re: Need function which uses IF with AND/OR

Post by Matareuz »

Welcome to the forum,

That's really easy.

Code: Select all

=IF(OR(A1+A2=2;A1+A2=4);2;1)

Code: Select all

=IF(AND(A3=1;A4=2;A5=2;A6=1);"Black";"Else")
You should take a look of this tutorial, "Ten concepts that every Calc user should know" by "MrProgrammer"

viewtopic.php?t=39529
LibreOffice 6.3.2.2 Windows 7 Ultimate
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Need function which uses IF with AND/OR

Post by Villeroy »

and what if a1+a2 gives some result other than 2 or 4?
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
Post Reply