Cannot convert text to number

Having Excel data column with memory sizes with some as 16 384 (the space makes it viewed as text) and some as number (256).
Could not transform 16 384 to number. I tried using compact and replace to remove the space but it did not work

Hi Arto,

After you removed spaces the text still needs to be converted to number. Try using this expression for converting text with spaces to numbers:

asnumber(removechars([Memory size], ' '))

***Moving the topic to #uncategorized

1 Like


Turns out it shows as space but seems to be a special char (weird). I managed to solve switching back to another tool. At the time being this is a show stopper for me to further. If it helps the other tool allows for forcing the datatype to int and I guess that behind the seen it removes anything that is not number nor decimal separator


If you need to keep only numbers and the decimal separator, you can use keepchars(). It’s a good way to deal with invalid characters:

asnumber(keepchars([Memory size], '0123456789.-'))

PS. I’ve seen your feature suggestion for data type conversion. We’ll have something for this in version 3.6 or 3.7. Thanks for the feedback, anyway.

Thanks a lot for your prompt answer. Tried and does not work. I created a sample spreadsheet that I can send if you want to try out !. Regards

It works if I create a new column with the formula

You can replace existing columns using expressions too. There is “Modify column” transformation for this.

Regarding column types in general: EasyMorph, unlike other tools allows mixing text and numbers in the same column, like Excel does. Therefore it’s typically much better suited for parsing Excel spreadsheets and XML files than tools with strict column types. As for “automagical” type conversions – while it’s very convenient in some cases, the lack of understanding how the “magic” actually works can lead to unexpected “surprises” when “magical” conversion didn’t work as expected and it was overlooked. The formula-based approach, while more tedious, gives you full control and predictability of the outcome. That’s why EasyMorph relies more on explicitly defined calculations rather than “magic” (which sometimes can be less time-consuming, for sure). In EasyMorph there is a whole range of tools for dealing with different data types, formats, invalid values, values out of acceptable range, etc. But it requires a bit of practice and learning.

If something doesn’t work feel free to upload the source files and the project(s). We’ll make it work :slight_smile: