Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

trim all before last space?

Hi,

Not a Qlikview developer, I've the formula working in excel but cant quite get it right in QV Not sure if QV has something similar to the "search" formula in excel?

=RIGHT(B2,LEN(B2)-SEARCH(" ",B2,SEARCH(" ",B2,1)+1))

Thanks a lot in advance and happy christmas

Dan

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Try subfield(B2,' ', -1)

And the equivalent of Excels Search() function is the Index() function.


talk is cheap, supply exceeds demand

View solution in original post

8 Replies
Gysbert_Wassenaar

Try subfield(B2,' ', -1)

And the equivalent of Excels Search() function is the Index() function.


talk is cheap, supply exceeds demand
MarcoWedel

Mid(B2,Index(B2,' ',2)+1)

Not applicable
Author

This answer replicates exactly my excel formula, however I realised my formula in excel wasn't working correctly for some cases.

Thanks both!!

its_anandrjs

Can you post any example here.

Regards

Anand

saurabh5
Creator II
Creator II


hi Daniel,

if it is just trimming  last few spaces then you can use rtrim() function, this will remove spaces from right side of the string.

Regards

Saurabh

Not applicable
Author

I have a field that contains information like this:

AB Leichire Heah POS0953

I only need the last part  (POS0953) to create a new field with it.

The suggested by Gysbert works beautifuly:

subfield(B2,' ', -1)

Regards,

Dan


MarcoWedel

please mark Gysbert's answer correct.

thanks

regards

Marco

its_anandrjs

Yes Gysbert is right

for pick last right value from AB Leichire Heah POS0953

you have to use  subfield(B2,' ', -1)

Similary if you want last second then use subfield(B2,' ', -2)

Similary if you want last third then use subfield(B2,' ', -3)

Regards
Anand