How to cut a Text from a specific character


#1

Hello

I have a column country Long that have a list of country formated such as :
Germany-Europe
France-Europe
Morroco-Africa

I want to have in another column country short , values such as :
Germany
France
Morroco

I have tried the following but return an error ,
Country* = LEFT([country_long];FIND("-"; [country_long];1;0)-1)

“An argument of Function LEFT has a wrong Data Type , or has an invalid value”

while FIND("-"; [country_long];1;0)-1 brings back 8 has value for Germany-Europe , i cannot parse it into the LEFT function , i have tried Value() around it but same error returned.


#2

johannphill,

What I do is: From within the Query editor right click on the column and select replace values. In the popup put -Europe in the Value to find box and put nothing in the replace with box. Select OK and the column is trimmed

Guy


#3

Hello GuyJohnson ,

Thanks , I also thought about that , but would not be a sustainable solution, in long term, just a shortcut , more to that all countries are not based in Europe , so would have to repeat it for as many as item type needed to be removed.


#4

Johannphill,

Then what I would do, assuming that the data has the same look Country-Continent is to split the column to the left of the - and then remove the column you don’t need.

Guy


#5

Thanks Guy Johnson , it’s actually working perfectly as expected .


#6

Happy to help.

On a side note you could split the -Continent column and keep the Continent and remove the column with the - in it.

That way the continent is available if you ever need to slice the data based on the continent.

Guy