К тексту на этой странице мог быть частично применён машинный перевод.

Функция HAS

Searches for an exact match of a single value, including if this value appears in a multicontact or multiselect dropdown column cells or ranges with other values. If HAS finds the exact match, it returns "True." Otherwise, it returns "False."

Синтаксис

HAS(search_range, criterion)
  • диапазон_поиска
    Ссылки на ячейки или диапазон ячеек, в которых выполняется поиск.
  • критерий
    Искомое значение.

Пример использования

=IF(HAS([Day of Week]: [Day of Week], "Monday"), "yes", “no”)

Примечания об использовании

  • 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.

Примеры

Here are some examples of using HAS in a sheet.

ФормулаОписаниеРезультат
=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.

Истина

Остались вопросы?

Используйте шаблон Руководство по работе с формулами, чтобы просмотреть дополнительные ресурсы и изучить более 100 формул. Руководство содержит глоссарий, описывающий каждую функцию, обращение с которой вы сможете отработать на практике, и примеры как часто используемых, так и более сложных функций.

Изучить примеры того, как эту функцию применяют другие пользователи Smartsheet, или задать интересующий вопрос можно в Сообществе Smartsheet.

Обратиться к Сообществу