Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
SupDog
Contributor
Contributor

STUFF String Equivalent

I have city and state in one field and I need to add a comma after the city.

Dallas TX

Little Rock AR

I tried using this: IF(wildmatch(Location,'* * *'),Mid(Location, 0, Len(Location) - index(Location,' ',2)) & ', ' & Mid(Location,index(Location,' ',2)),Mid(Location, 0, Len(Location) - index(Location,' ',2)) & ', ' & Mid(Location,index(Location,' ',1)))

But that gives me

, TX

,Rock AR

Can you help me find where I'm off?  Or is there an easier way to go about this?

Labels (1)
1 Reply
sunny_talwar

May be this

=Left(FieldName, Index(FieldName, ' ', -1) - 1) & ', ' & SubField(FieldName, ' ', -1)