Syntax
HAS(search_range, criterion)
- search_range—The cell or cell range to search within
- criterion—The value that you want to find
Sample usage
=IF(HAS([Day of Week]: [Day of Week], "Monday"), "yes", “no”)
Usage notes
- The HAS function is designed to work with multi-select dropdown and multi-contact columns. It won’t cause an error if used with other column types, but it will only return true if the criterion exactly matches the contents of the cell or a distinct value within a multi-select or multi-contact cell.
In the example above, if [Day of Week]1 is in a Text/Number column, HAS will return “true” if [Day of Week]1 = “Monday” but will return “false” if [Day of Week]1 = “Monday Tuesday.” If [Day of Week]1 is in a multi-select column, HAS will return “true” if [Day of Week]1 = “Monday” and will also return true if [Day of Week]1 contains values of “Monday” and “Tuesday”. It will return “false” if the value in [Day of Week]1 = “Monday Tuesday”. - The HAS function is distinct from CONTAINS because it searches for specific values where CONTAINS searches for strings or characters containing the criteria.
For example, using HAS to search for “apples” will only return true if “apples” is by itself in a text/number column or is a distinct value within a multi-select column. Using CONTAINS to search for “apples”, on the other hand, will return true if it finds “apples” in any part of a text/number cell, or within any distinct value inside a multi-select cell.
Examples
Here are some examples of using HAS in a sheet.
Formula | Description | Result |
---|---|---|
=SUMIF([Clothing Item]:[Clothing Item], HAS(@cell, "T-Shirt"), [Units Sold]:[Units Sold]) | Sums the cell values in the Units Sold column if the adjacent cell in the Clothing Item column of the same row has the exact matching value of T-Shirt Row 1 meets these criteria. | 78 |
=COUNTIFS([Sold Date]:[Sold Date], HAS(@cell, "1:55 PM")) | Counts the cell values in the Sold Date column that has the exact matching value of value 02/15/19 1:55 PM Row 2 meets the criteria. | 1 |
=IF(HAS([Clothing Item]:[Clothing Item], "Jacket"), "True", "False") | If the Clothing Item column has the exact matching value of Jacket, the formula produces the value True. Row 3 meets these criteria. | True |
Still need help?
Use the Formula Handbook template to find more support resources and view 100+ formulas, including a glossary of every function that you can practice working with in real time, and examples of commonly used and advanced formulas.
Find examples of how other Smartsheet customers use this function or ask about your specific use case in the Smartsheet online Community.