# Power Query Trouble Converting Text to Number



## cr731 (Apr 19, 2016)

I have a table with a Values column, and there are some entries that represent zero but are actually text in the form of a hyphen, and there are spaces in the value, for instance,

" -   "

I've tried everything I can think of but cannot get Power Query to convert this to a zero.  I've tried,


Changing the data type to Number (results in an error, DataFormat.Error: We couldn't convert to Number)
Tried replacing spaces " " with null, but Replace Values won't let me make the value to replace a space - it says I must enter a number, not text.
Tried using a custom column with Number.FromText

Surely there must be an easy way to resolve this?

Thanks


----------



## anvg (Apr 19, 2016)

Hi
Try to use exception statement. For example

```
let
     source = try Number.From(" - ") otherwise 0
in
    source
```
Regards,


----------

