How to get numbers only from a mixed cell content?

I want to equal another cell to the NUMBER but it either returns ##VALUE## or when I use VALUE(REGEX(A2)) it returns Err 511 or when I directly equal it, it returns 1. I can set the cell A2 containing the piece as Text for the other cell to make use of these functions but I cant seem to get the number alone?

This piece is taken from an outside script, it is is empty spaces (or line breaks) number and comma, to be exact a script pasted with Fixed Width gets distributed among cells and one of the cells contains this value, I want to take the number of it alone.

    1340,

What result (other than Err: 511) do you expect from REGEX(A2)? Did you mean =VALUE(REGEX(A2;"\d+"))?

Thanks, that does it but it also deletes - in negative numbers? I want to keep the minus

OK Google, regex extract negative number? - =VALUE(REGEX(A2;"-?[0-9]\d*(.\d+)?"))

1 Like

Became more complex for me to figure it out, so thanks, that works!