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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out 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
MVP
MVP

May be this

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