Using the If( ) formula for logical functions This is why the overall IF formula returns the IF FALSE text value (“No”), instead. In cell A4, all four arguments in the IF with OR formula are incorrect.
All four arguments are correct in the A2 IF with OR formula, while A3 has two incorrect arguments out of four. In our examples below, the two IF with OR formulas in cells A2 and A3 returned the IF TRUE text value (“Yes”). Replace the OR argument (or arguments), and your IF TRUE/FALSE values, as required. To use OR with IF, click an empty cell and type =IF(OR(OR Argument 1), Value IF TRUE, Value IF FALSE). Only one OR argument has to be correct for IF to return a TRUE response. The same as with AND, you can also use OR with IF to create a complex logical test. As AND requires all arguments to be correct, IF returns the IF FALSE value, which is a different text value (“No”). In cell A3, a similar IF with AND formula contains two incorrect arguments. All four arguments are correct, so the IF TRUE value (in this case, “Yes,”) is returned. In our example below, we used IF with a nested AND formula in cell A2 with four arguments. To use AND within an IF formula, type =IF(AND(AND Argument 1), Value IF TRUE, Value IF FALSE), and replace your AND argument (or arguments), and IF TRUE and IF FALSE values. For example, as shown below, =IF(E2=1,3,4) causes IF to return the number 3 if cell E2 equals 1 otherwise, it returns the number 4.īecause IF only supports a single argument, you can use AND and OR to introduce complex logical tests with multiple arguments. The format of a formula using IF is =IF(Argument, Value IF TRUE, Value IF FALSE). When you use IF, if an argument is TRUE, it returns one value otherwise, it returns another value. In the example below, the OR formulas in cells A4 and A5 returned a FALSE response because all three arguments in both formulas are incorrect.īecause AND and OR are logical functions with TRUE and FALSE responses, you can also use them with IF.
For a FALSE result, all the arguments you use must be incorrect. Unlike when you use AND, one incorrect argument out of three will result in a TRUE result. In the example below, the formula using OR in cell A2 has one incorrect argument out of three (F3=10, where F3 actually equals 3). To use OR, click an empty cell and type =OR(Argument A, Argument B), and replace the arguments with your own. The same as with AND, you can use as many arguments as you want, but you must have at least one for it to work. Like AND, you can use the OR function on its own or combine it with other functions. While AND requires all the arguments it uses to be true, the OR function only requires one to be true for OR to respond with TRUE. In the example below, the AND formula in cell A3 has two correct arguments and one that’s incorrect (F3=10, while F3 actually equals 3). If we change any of these arguments, it will cause the AND formula in A2 to change the response from TRUE to FALSE. The second argues that the cell E3 equals the number 17.įinally, the third argues that the value of cell F3 (which is 3) is equal to the calculation of 4-1.Īs all three arguments are true, the AND formula responds with TRUE in cell A2. The first argument is the simple calculation of 1+1=2. In the example below, we used three arguments. You can use as many arguments as you’d like, but you must have at least one for AND to work. Type =AND(Argument A, Argument B) and replace each argument with the criteria you want to use. To get started, open a Google Sheets spreadsheet and click an empty cell. You can use the AND function on its own or combined with other functions to provide a logical (TRUE or FALSE) test. You can use AND and OR separately or within other functions, like IF. If you use OR, only one argument has to be true for OR to provide a TRUE response. If you use AND with multiple arguments, all of those arguments must be true to get a TRUE response otherwise, AND responds with FALSE. These logical functions give you TRUE and FALSE responses, which you can use to sort through your data.
If you’ve ever wanted to check whether data from your Google Sheets spreadsheet meets certain criteria, you can use AND and OR. He has a degree in History and a postgraduate qualification in Computing. Since leaving the classroom, he’s been a tech writer, writing how-to articles and tutorials for MakeUseOf, MakeTechEasier, and. In a past life, he was a UK college lecturer, training teens and adults. Ben Stockton is a freelance tech writer from the United Kingdom.