> For the complete documentation index, see [llms.txt](https://concentra-analytics.gitbook.io/working-with-data/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://concentra-analytics.gitbook.io/working-with-data/strings/contains.md).

# Contains

Contains is a way of testing whether part of your string matches some specified text, which can be useful if you want to search for or extract key words or perform some kind of fuzzy matching (comparing similar but not identical values).

NB. `Contains` functions are case sensitive, so transforming the value being checked to upper/lower case before searching is a good way of avoiding incorrect results because of inconsistencies in case. All below examples are transformed to upper case for this reason.

## Excel

Excel does not have a specific `CONTAINS` function. Instead, use `FIND` to return the index of a string if found, or throw an error if the string is not found. You can then use `NOT(ISERR())` to check that the result of `FIND` is an error; if the result is `TRUE`, the cell contains the target string: \
&#x20;\=\~NOT!\~(\~ISERR!\~(\~FIND!\~(‹target\_string›, ‹within\_string›)))

```
=NOT(ISERR(FIND("MANAGE",UPPER(A2))))
```

## Tableau

\~CONTAINS!\~(‹within\_string›, ‹target\_string›)

```
CONTAINS(UPPER([Role]), "MANAGE")
```

## Alteryx

\~CONTAINS!\~(‹within\_string›, ‹target\_string›«, case\_sensitive»)

```
CONTAINS([Role], "MANAGE") // case insensitive

CONTAINS([Role], "Manage", 0) // case sensitive
```

NB. Omitting `case_sensitive` or setting it to `1` means that `CONTAINS()` will ignore case. Including a `0` will make it respect case.

## OrgVue

OrgVue does not have a specific contains function. Instead, use `indexOf()`, to return the index of a string if found, or `-1` if the string is not found. You can use an if statement to check whether the result is > -1 and use this a proxy for testing whether a cell contains the target string: \
&#x20;‹collection›.value.\~indexOf!\~(‹target\_string›) > -1

```
node.role.value.toUpperCase().indexOf('MANAGE') > -1 
// Returns True|False
```

```
['UK', 'France', 'Germany', 'Spain', 'Italy'].indexOf(node.country) > -1 ? "Europe" : "Other"
// If node.country is one of the 5 countries in the array, return "Europe", 
// else return "Other"
```

## tSQL

\~CONTAINS!\~(‹within\_string›, ‹target\_string›)

```
SELECT * 
FROM EmployeeData 
WHERE CONTAINS(Role, "MANAGE")
```

NB. Case and punctuation are ignored. For more information about the behaviour of `CONTAINS`, see: <https://msdn.microsoft.com/en-us/library/ms187787.aspx>.

## Python

‹target\_string› \~in!\~ ‹within\_string›

```
"MANAGE" in role.upper()
```

```
"Europe" if country in ['UK', 'France', 'Germany', 'Spain', 'Italy'] else "Other"
# If the variable country is one of the 5 countries in the array, return "Europe", 
# else return "Other"
```

NB. The above example assumes a variable has been declared for `role`. For more information, go to [General > Variables](https://orgvue.gitbooks.io/formula-translator/content/general/variables.html).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://concentra-analytics.gitbook.io/working-with-data/strings/contains.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
