IF with AND function – multiple conditions
The AND function allows you to have multiple conditions in an IF function, you can have up to 254 arguments. An argument is an input value given to a function. You construct a logical expression that you use as an argument in the AND function.
The IF function above checks two conditions, the "Region" value must match a text string and the "Amount" value must be larger than a number. If both conditions return TRUE the AND function returns TRUE.
IF REGION = value AND Amount > number then TRUE Else FALSE
In other words, all logical tests in each argument in the AND function must return TRUE for the AND function to return TRUE. The AND function returns FALSE if at least one argument returns FALSE.
You can shorten the formula somewhat by enclosing each logical expression with parentheses and then multiply the conditions. The asterisk * means multiply.
The first logical expression in cell B4 is (B4="South America") and it returns TRUE, the second expression (C4>5) also returns TRUE. TRUE multiplied with TRUE is 1.
TRUE is the same thing as 1 and FALSE is 0 (zero). If you multiply boolean values the outcome is always 0 (zero) or 1.
The array formula above lets you check if all values in cell range B3;B5 are not empty and if all numbers in C3:C5 are above 0 (zero). It returns TRUE if all conditions are TRUE.
There are many conditions in above formula and the array formula lets you do this without problems.
To enter an array formula press and hold CTRL + SHIFT simultaneously, then press Enter once. Release all keys.
The formula bar now shows the formula enclosed with curly brackets telling you that you entered the formula successfully. Don't enter the curly brackets yourself.
Download excel *.xlsx
Question: I have a list that I keep adding rows to. How do i create a border that expands as […]
Count entries based on date and time
Question: My issue is that I get the date in this format: 7/23/2011 7:00:00 AM I am trying to count […]
If cell contains text from list
This article demonstrates several ways to check if a cell contains a value based on a list. The first example […]
Checks if a logical expression is met. Returns a specific value if TRUE and another specific value if FALSE.
Nested IF statements in a formula are multiple combined IF functions so more conditions and outcomes become possible. They all are […]
If cell contains text from list
This article demonstrates several ways to check if a cell contains a value based on a list. The first example […]
Nested IF statements in a formula are multiple combined IF functions so more conditions and outcomes become possible. They all are […]
2 Responses to “IF with AND function – multiple conditions”
Leave a Reply
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
If"different places" then will different number with multiple condition. Do you know the formula?
if KL = 23565
IF Sel = 24633
IF Johor = 16842
IF Melacca = 19014
FORMULA NOT WORKING
OR(MATCH("*FT*",A2:F2,0) = TRUE,MATCH("*MTR*",A2:F2,0))= FALSE, RESULT = " "
BUT SINGLE FORMULA WORKING LIKE- ("*FT*",A2:F2,0) = TRUE
("*MTR*",A3:F3,0)= TRUE, BUT NOT WORKING WITH OR
IF(VALUE IF FALSE) ALSO NOT WORKING
IF(A2="FT",A2,IF(A2="MTR",A2))
HERE A2=FT
SAME FORMULA IN A3=MTR, NOT WORKING
USING OFFICE 2016