Bernard K

Jul 15, 2022

The FIND & FINDNTH Functions in Tableau

Introduction

The FIND function

Syntax

FIND (String, Sub-string, Start)

This function returns the index position of a ‘sub-string’ in a ‘string’, or 0 (zero) if the ‘sub-string’ isn’t found. If the optional argument ‘Start’ is added, the function ignores any instances of ‘sub-string’ that appear before the index position ‘Start’. Note, the first character in a string is position 1.

For example.

FIND (“Dashboards”, “a”) = 2

FIND (“Dashboards”, ”a” ,5) = 7

FIND (“Dashboards”, “axed”) = 0

FIND (“Dashboards”, “a”, 2) = 2

FIND (“Dashboards”, “ash”) = 2

Use case of FIND function in Tableau

One of the use cases of FIND function is when extracting the domain name from an email address.

For example, extracting the domain part of this email “xyz@rigordatasolutions.com” using the following calculation.

MID (“xyz@rigordatasolutions.com”, FIND (“xyz@rigordatasolutions.com”, “@”)+1) =”rigordatasolutions.com”

Useful: Learn how to apply MID function in Tableau

The FINDNTH function

Syntax

FINDNTH (String, Sub-string, Occurrence)

This function returns the position of nth occurrence of sub-string within the specified string. Where n is defined by the occurrence argument.

Note, FINDNTH function is not available in all data sources.

For example.

FINDNTH (“Dashboards”, “a”, 2) = 7

FINDNTH (“Dashboards”, “s”, 2) = 10

I hope this short article was helpful to you. To receive more of the Tableau tips, kindly join our mailing list by subscribing below.

Thank you for reading.