CONTAINS Function

另一个函数中使用searc吗h for a character or string. It will return "True" if it found the character or string. Otherwise, it will return "False."
Sample Usage
IF(CONTAINS("Jacket", [Clothing Item]:[Clothing Item]), "True", "False")
Syntax
CONTAINS(
  • search_for
  • range
)
  • search_for
    The text or a cell reference to find
  • range
    The group of cells to evaluate
Examples

This example references the following sheet information:

Row #

Clothing Item

Units Sold

销售日期

Status

1

T-Shirt

78

02/12/19 10:23 PM

Green

2

Pants

42

02/15/19 1:55 AM

Red

3

Jacket

217

02/20/19 2:45 PM

Yellow

Given the table above, here are some examples of using CONTAINS in a sheet:

Formula

Description

Result

=SUMIF([Clothing Item]:[Clothing Item], CONTAINS("T-Shirt", @cell), [Units Sold]:[Units Sold])

Sums the cell values in theUnits Soldcolumn if the adjacent cell in theClothing Itemcolumn of the same row contains the valueT-Shirt.

Row 1 meets this criteria.

78

=COUNTIFS([Sold Date]:[Sold Date], CONTAINS("1:55 AM", @cell))

Counts the cell values in the销售日期column that contains the value1:55 AM.

Row 2 meets the criteria.

1

=IF(CONTAINS("Jacket", [Clothing Item]:[Clothing Item]), "True", "False")

If the valueJacketis contained within a cell of theClothing Itemcolumn produce the valueTrue.

Row 3 meets this criteria.

True

Still need help?

Use theFormula Handbook templateto 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.

Ask the Community