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

Функция COLLECT

Used within another function to select specific values in a range that meets the provided criteria

Синтаксис

COLLECT(range, criterion_range1, criterion1, [criterion_range2, criterion2, ...])
  • диапазон
    The group of values to include in the final list.
  • criterion_range1
    The group of cells to be evaluated by the criterion.
  • критерий1
    The condition that defines which values to collect.
  • criterion_range2, критерий2, ... —(необязательно)
    Additional ranges and criteria to have evaluated. All criteria must be met to be collected.

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

MIN(COLLECT(Cost1:Cost5, Cost1:Cost5, > 0))
JOIN(COLLECT(Name1:Name5, Status1:Status5, "Active"), ", ")

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

  • Use JOIN(COLLECT(), "- ") to see all values and/or error messages produced by the COLLECT for troubleshooting.
  • COLLECT must be used within another function as the primary range element.
  • All listed criteria must be met to add the value to the range.
  • Range and Criterion_ranges must be the same size and in the same sheet.
  • If the range to collect and criteron_range are the same, they must be listed twice. 
  • Errors with COLLECT may not be visible when used with another function, such as COUNT.
    • COUNT(COLLECT()) functions with errors will give a result of 1, as COUNT will detect the single error value and count it instead of carrying it forward

Примеры

В примере ниже используется информация из этой таблицы.

 Предмет одеждыОбщая сумма операцииПродано единицЕсть в наличии?
1Футболка1 170,0078
Brandfolder Image
Unchecked checkbox.
2Брюки1 491,0042
Brandfolder Image
Unchecked checkbox.
3Куртка812,00217
Brandfolder Image
Checked checkbox.

Вот несколько примеров использования функции DATE для данных из таблицы выше.

ФормулаОписаниеРезультат
=AVG(COLLECT([Units Sold]1:[Units Sold]3, [In Stock?]1:[In Stock?]3, 0, [Transaction Total]1:[Transaction Total]3, >1000 ))Averages the Units Sold column if the In Stock? column is unchecked and Transaction Total exceeds 1,000. Rows 1 and 2 apply. 60
=JOIN(COLLECT([Clothing Item]1:[Clothing Item]3; [In Stock?]1:[In Stock?]3; 0); ", ")Joins the values in the Clothing Item column if the In Stock? column is unchecked, separating the values with a comma and a space.  Rows 1 and 2 apply. T-Shirt, Pants
=MIN(COLLECT([Transaction Total]1:[Transaction Total]3, [Units Sold]1:[Units Sold]3, >50))Returns the lowest number from the Transaction Total column where more than fifty units were sold. Этому критерию отвечает строка 3.812,00

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

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

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

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