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: 
Anonymous
Not applicable

Extract Text from Field

Hello,

I have a list of SKU numbers and descriptions like the following:

567 - MICROWAVE 6 1/2 C

How would I extract everything after the hyphen?

Thanks!

Isabel

7 Replies
eduardo_sommer
Partner - Specialist
Partner - Specialist

Hi

subfield(SKU, '-',2)

eduardo

venkatg6759
Creator III
Creator III

Use subfield funcion

Subfield(ltrim(Right(Replace(SKU),'-',' '),3))

Anonymous
Not applicable
Author

Hello,

Thanks!

What if I were to have something like

4576 - Flower Pot - Misc

and want everything after the first hyphen?

Isabel

eduardo_sommer
Partner - Specialist
Partner - Specialist

This should work

=right(SKU,index(SKU,' - ',-1))

Eduardo

Anonymous
Not applicable
Author

Hmm..that doesn't work in every case. It usually only gives me everything after the last hyphen.

maxgro
MVP
MVP

everything after first hyphen

=right(SKU,  len(SKU - index(SKU, '-', 1))

everything after last hyphen

=right(SKU,  len(SKU - index(SKU, '-', -1))

swuehl
MVP
MVP

Or a little shorter using mid() function:

=mid(SKUindex(SKU, '-', 1)+1)