'How to return a word from between nth comma and n+1 th comma?

I want to extract a word from text which is separated by commas.

This is one of the data from users.

117573,117573,219,219,75,75,Messi,barcelona,53780217,forward,[email protected]

I want to get "Messi" from the data.

I can use the "text to columns" function but our data is dynamic and whenever I export it, I have to do that again and again.

I tried "MID, FIND" text formulas but in the next updates, the number of commas will change.

I am looking to a VBA code as:

Function_name(A2;6;7) => RETURN "Messi"

6= starting comma
7= the comma after the word



Solution 1:[1]

Found code from https://trumpexcel.com/vba-split-function/

Function ReturnNthElement(CellRef As Range, ElementNumber As Integer)
Dim Result() As String
Result = Split(CellRef, ",")
ReturnNthElement = Result(ElementNumber - 1)
End Function

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Community