Gaurav Gupta
Gaurav Gupta

Reputation: 4691

How to split and find last index in Google Sheets?

I need to achieve something like following in Google-sheets:

tag_name    
A_B_C       C
A_B_C_D     D

I am using following formaula:

=INDEX(SPLIT(B2, "__"), 0, 3)

I want to dynamically pass last index of the set of values returned by split.

Upvotes: 2

Views: 3109

Answers (2)

player0
player0

Reputation: 1

for arrayformula try:

=ARRAYFORMULA(IFNA(REGEXEXTRACT(A1:A; "_(.)$")))

enter image description here

Upvotes: 1

Rocky
Rocky

Reputation: 990

You can try REGEXEXTRACT formula, I am assuming your data range starts from "A1". Put this formula in "A1" and fill it down per your requirement

=REGEXEXTRACT(A1,"\S$")

enter image description here

Upvotes: 4

Related Questions