# Using INSTR in BigQuery

If you ever need to do something different based on the existence of a particular substring in hashtag#BigQuery, take a look at the INSTR function.

It returns the 1-based index of the first occurrence of a substring (1 or more characters) in another STRING. The function returns 0 if the substring was not found.

There's also a possibility to specify at what position to start the search (like in good old Excel) and which occurrence to get.

![](https://miro.medium.com/v2/resize:fit:1400/0*VgEZw6YNth1Ht_p2 align="left")

*Found it useful? Subscribe to my Analytics newsletter at* [*notjustsql.com*](https://www.notjustsql.com)*.*
