# The MID Function in Tableau.

> This is content from just-tim, the data-and-analytics channel by Tim Ngwena (formerly 'Tableau Tim'). Tim has 12+ years of hands-on BI experience and covers Tableau most of all, plus Power BI, Looker, Hex, SQL and data modelling, the analytics industry, and the craft of doing the job — always tool-agnostic and honest about the trade-offs.

- **Author:** Tim Ngwena (just-tim, https://just-tim.com/about)
- **Published:** 2021-06-08
- **Format:** Video · 7 min watch · transcript available
- **Topics:** Data prep, Analytics
- **Tools:** Tableau (calculated fields, find, mid)
- **Canonical:** https://just-tim.com/posts/the-mid-function-in-tableau
- **Watch:** https://www.youtube.com/watch?v=63Pi162gU2I

I walk through Tableau's MID function, a string function that returns text starting from a specified position, with an optional length argument. I demonstrate it on Superstore subcategories and then build a more practical example, combining MID with FIND to extract the domain from an email address.

## Key takeaways

- MID() returns characters from a string starting at a specified position, with an optional second argument controlling how many characters to return
- Choosing position 2 effectively drops the first character; the start position is treated as character one for the length count
- For neatly structured data, LEFT or RIGHT functions are usually simpler than MID
- Wrapping FIND() inside MID() lets you dynamically locate a character, such as finding the position of an @ sign
- Adding +1 to a FIND() result lets you start MID one character past the matched character, useful for extracting an email domain

## Chapters

- 0:00 Why this function caught me out
- 0:28 Setting up the Superstore example
- 0:54 How the MID function works
- 3:14 Adding the optional length argument
- 4:42 Dynamic use case with FIND

Watch the full video, read the transcript and use chapter deep-links on the page: https://just-tim.com/posts/the-mid-function-in-tableau

---
just-tim — Data and analytics, with a point of view. · https://www.youtube.com/channel/UC7HYxRWmaNlJux-X7rNLZyw · https://twitter.com/TableauTim · https://www.linkedin.com/in/timngwena
