How to Split String in Tableau

Cody Schneider7 min read

Dealing with messy text fields is a common data prep challenge, but Tableau comes equipped with surprisingly powerful tools to handle it. Having a single column with combined information, like a full name or a location, can stop your analysis cold. This guide will walk you through three different methods for splitting a single string of text into multiple, usable columns directly within Tableau.

Why Would You Need to Split a String in Tableau?

Splitting strings is a fundamental part of data cleaning and preparation. You might have downloaded data from a CRM, a web form, or a legacy system where information is bundled together in a single text field. To perform any meaningful analysis, you need to break that bundled data into individual pieces.

Common scenarios include:

  • Full Names: A column like "Customer Name" contains "Jane Doe". You need separate "First Name" and "Last Name" columns for personalization or analysis.
  • Geographic Data: A "Location" field might be formatted as "New York, NY". Splitting it by the comma allows you to analyze data by city and state separately.
  • Product Codes or SKUs: A product identifier like "SHOE-BLUE-10" contains the product type, color, and size. Splitting it by the hyphen gives you three distinct attributes to filter and group by.
  • Log Data: A string might contain a user ID, timestamp, and action, all separated by a specific character. You need to parse this string to analyze user behavior.

By splitting these strings, you transform a single, messy dimension into multiple clean, organized dimensions that you can use to build richer and more insightful visualizations.

Method 1: The Quick and Easy Automatic Split

Tableau's simplest option is the automatic "Split" feature. This is your best first choice when your data has a consistent, common separator like a space, comma, or hyphen. Tableau's data engine is smart enough to examine your data, identify the common delimiter, and automatically perform the split for you with just a couple of clicks.

This method works best from the Data Source page, before you start building your worksheets.

How to Use Automatic Split:

  1. Navigate to the Data Source tab in the bottom-left corner of your Tableau workbook.
  2. In the data preview grid, find the column (dimension) you want to split. For this example, let's use a "Customer Name" field containing full names like "John Smith" and "Maria Garcia".
  3. Click the small downward-facing arrow on the column header.
  4. From the dropdown menu, select Split.

That's it! Tableau will instantly create new columns based on the delimiter it found (in this case, a space). You'll see new fields appear in your data grid, usually named something like Customer Name - Split 1 and Customer Name - Split 2.

For best practice, you should immediately rename these columns to something more meaningful, like "First Name" and "Last Name". You can do this by double-clicking the new column header and typing your new name.

Method 2: Taking Control with a Custom Split

Sometimes, the automatic split doesn't get it quite right. Maybe your data has an uncommon delimiter, or you need to split off a specific number of columns. This is where "Custom Split" gives you more precision. Like the automatic split, this is best done on the Data Source page.

Let's imagine you have a column named "Order ID" with values like REF-94032-US and REF-1T09A-CA.

How to Use Custom Split:

  1. On the Data Source page, click the dropdown arrow on the header of the column you want to split (e.g., "Order ID").
  2. This time, select Custom Split... from the menu.
  3. A dialog box will appear, giving you several options:

After you set your options and click "OK," Tableau will create the new—and improved—columns for you, which you can then rename for clarity.

Method 3: The Power-User's Choice with the SPLIT() Function

For maximum flexibility, you can use Tableau's built-in SPLIT() function inside a calculated field. This is the most powerful method for a few key reasons:

  • It can be used directly on a worksheet, not just on the Data Source page.
  • The resulting calculated field can be used within other calculations.
  • It offers an incredible amount of control over which piece of the string you want to extract.

The SPLIT() function has a straightforward syntax:

SPLIT(string, delimiter, token number)

Breaking Down the Syntax:

  • string: This is the text field you are splitting, like [Customer Name] or [Order ID].
  • delimiter: The separator character, which must be enclosed in quotes. For example, " " for a space, "," for a comma, or "-" for a hyphen.
  • token number: This specifies which piece, or "token," you want from the split string. 1 is the first piece, 2 is the second, and so on. You can also use negative numbers to count from the end of the string. -1 is the last piece, -2 the second-to-last, etc.

Example 1: Getting First and Last Names

Let's return to our [Customer Name] field. To get the first name, you'd create a new calculated field called "First Name" with this formula:

SPLIT([Customer Name], " ", 1)

To get the last name, you'd create another calculated field named "Last Name" with:

SPLIT([Customer Name], " ", 2)

If some names might have a middle name or initial, like "John Fitzgerald Smith", using SPLIT([Customer Name], " ", -1) is a more robust way to get the last name, as it always grabs the final token.

Example 2: Parsing an Email Address

Imagine you have a list of email addresses and you want to analyze the domains. A [Email] field might contain "sara.jones@abccorp.com".

To extract the username, you can split by the "@" symbol and take the first token:

SPLIT([Email], "@", 1)

To get the domain name, you just need the second token:

SPLIT([Email], "@", 2)

Tips for Working with Your Newly Split Fields

Once you've split your strings, your work might not be done. Here are a few common next steps to make sure your new data is ready for analysis.

Clean Unwanted Spaces

Often, splitting a string like "City, State" leaves you with a leading space in the state field (e.g., " State"). You can easily clean this up by wrapping your SPLIT() function in a TRIM() function. TRIM() removes any leading or trailing spaces from a string.

TRIM(SPLIT([Location], ",", 2))

Change Data Types

Any field created through a split will default to being a string data type. If your split has uncovered a number (like a product ID or a price) or a date, you'll need to change the data type for proper analysis. You can do this by clicking the "Abc" icon next to the field name in the Data pane and selecting the correct type, like Number (whole) or Date.

Handle Uneven Splits

What happens if your data is inconsistent? For example, some names are "John Smith" but others are "John Q. Smith". SPLIT([Customer Name], " ", 2) on the second name would return "Q.", not "Smith". This is a great scenario for using that negative token trick (SPLIT([Customer Name], " ", -1)), which reliably extracts the last name regardless of how many middle names are present.

Final Thoughts

Splitting strings is a core data preparation skill that takes you from having messy, unusable text to clean, structured fields for insightful analysis. Whether you choose the quick automatic split, the more granular Custom Split, or the highly flexible SPLIT() function in a calculated field, you are now well-equipped to tame your text data in Tableau.

Wrangling tedious text data is often just one step in a much longer manual reporting process. We built Graphed to automate these painful roadblocks entirely. Instead of connecting, cleaning, and manually building reports, you can use simple, conversational language to ask for exactly what you need. A query like "Create a dashboard showing our sales pipeline from Salesforce broken filtering by product category" instantly generates a live, shareable dashboard, effectively doing all the data prep for you in seconds.

Related Articles

How to Connect Facebook to Google Data Studio: The Complete Guide for 2026

Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.

Appsflyer vs Mixpanel​: Complete 2026 Comparison Guide

The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.