And
Returns "true" if all its arguments evaluate to "true"; returns "false" if one or more arguments evaluate to "false".
One common use for the AND function is to expand the usefulness of other functions that perform logical tests. For example, the IF function performs a logical test and then returns one value if the test evaluates to "true" and another value if the test evaluates to "false". By using the AND function as the logical_test argument of the IF function, you can test many different conditions instead of just one.
Syntax
AND(value1, [value2], ...)
The AND function syntax has the following arguments:
- value1 Required. The first condition that you want to test that can evaluate to either "true" or "false".
- value2, ... Optional. Additional conditions that you want to test that can evaluate to either "true" or "false", up to a maximum of 255 conditions.
Remarks
- The arguments must evaluate to logical values, such as "true" or "false"
- If an array or reference argument contains text or empty cells, those values are ignored.
- If the specified range contains no logical values, the field will be left blank.
Examples
Copy the example formulas into text box fields in your template
Formula | Description | Result |
---|---|---|
=AND("true", "true") | All arguments are true | true |
=AND("true", "false") | One argument is false | false |
=AND(2+2=4, 2+3=5) | All arguments evaluate to true | true |
Create two new text box fields, and update the names and insert these numbers in the Default Values of the fields:
Field Name | Default Value |
---|---|
Text Box 1 | 50 |
Text Box 2 | 104 |
Formula | Description | Result |
---|---|---|
=AND([Text Box 1]>1, [Text Box 1]<100) | Displays "true" if the number in field "Text Box 1" is between 1 and 100. Otherwise, it displays "false". | true |
=IF(AND([Text Box 2]>1, [Text Box 2]<100), [Text Box 2], "The value is out of range.") | Displays the number in field "Text Box 2", if it is between 1 and 100. Otherwise, it displays the message "The value is out of range." | The value is out of range. |
=IF(AND([Text Box 1]>1, [Text Box 1]<100), [Text Box 1], "The value is out of range.") | Displays the number in field "Text Box 1", if it is between 1 and 100. Otherwise, it displays a message. | 50 |
Updated over 1 year ago