How can I use the SPLIT function in Google Sheets to get the last item in a string? 2

How can I use the SPLIT function in Google Sheets to get the last item in a string?

The SPLIT function in Google Sheets allows users to easily extract specific parts of a string by splitting it into smaller segments. This function can be particularly useful when trying to retrieve the last item in a string. By specifying the desired delimiter, the SPLIT function will divide the string into separate sections and return the last one, making it a convenient tool for data analysis and organization. This feature offers a simple and efficient way to access the last item in a string without the need for complicated formulas or manual searching.

Google Sheets: Use SPLIT Function and Get Last Item


The SPLIT function in Google Sheets can be used to divide text based on a specific delimiter.

To get the last item that results from the SPLIT function, you can use the following syntax:

=INDEX(SPLIT(A2, " "), COLUMNS(SPLIT(A2, " ")))

This particular example will split the text in cell A2 using a space as a delimiter and then it will return only the last item that results from the split.

For example, if the string in cell A2 is Andy Bernard Douglas then this formula will return Douglas.

The following example shows how to use this formula in practice.

Example: How to Use SPLIT Function and Get Last Item in Google Sheets

Suppose we have the following column of names in Google Sheets:

Suppose we would like to split the names based on where spaces occur and then get only the last item that results from the split.

We can type the following formula into cell B2 to do so:

=INDEX(SPLIT(A2, " "), COLUMNS(SPLIT(A2, " ")))

We can then click and drag this formula down to each remaining cell in column B:

The formula splits the names in column A based on where the spaces occur and then only returns the last item from the split.

How This Formula Works

=INDEX(SPLIT(A2, " "), COLUMNS(SPLIT(A2, " ")))

Here is how this formula works:

First, the SPLIT function splits the text in cell A2 into new columns based on where the spaces occur.

For example, the name Andy Bernard Douglas is split into three columns.

Next, the COLUMNS function returns the total number of columns that result from the split.

For example, in this example it returns a value of 3.

Lastly, the INDEX function returns the value from only column 3 that results from the split.

The end result is that we’re able to get only the last item from the split, which is Douglas.

The following tutorials explain how to perform other common tasks in Google Sheets:

Cite this article

stats writer (2024). How can I use the SPLIT function in Google Sheets to get the last item in a string?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-use-the-split-function-in-google-sheets-to-get-the-last-item-in-a-string/

stats writer. "How can I use the SPLIT function in Google Sheets to get the last item in a string?." PSYCHOLOGICAL SCALES, 23 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-use-the-split-function-in-google-sheets-to-get-the-last-item-in-a-string/.

stats writer. "How can I use the SPLIT function in Google Sheets to get the last item in a string?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-use-the-split-function-in-google-sheets-to-get-the-last-item-in-a-string/.

stats writer (2024) 'How can I use the SPLIT function in Google Sheets to get the last item in a string?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-use-the-split-function-in-google-sheets-to-get-the-last-item-in-a-string/.

[1] stats writer, "How can I use the SPLIT function in Google Sheets to get the last item in a string?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How can I use the SPLIT function in Google Sheets to get the last item in a string?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top