Home > Enterprise >  Does RegexReplace return numbers?
Does RegexReplace return numbers?

Time:08-18

I'm working on some soccer data but got troubles that I can't solve. I'm really knew to codding, so I'm sorry if this is stupid.

I've an IMPORTHTML on the first tab which gives me a table from the league I want. I made a script to this IMPORTHTML update automatically, but the table comes with some carachters unwanted, so I want to remove them to cleam up the data.

I'm trying in another tab a QUERY function with REGEXREPLACE to clean the table everytime it is updated automatically, but cannot make it work. The table got many numbers values and this seems to be the problem.

This is the formula I'm using: =ARRAYFORMULA(REGEXREPLACE(QUERY(DATA!A1:N31);"[*]";""))

The caracther I want to remove is the "*" and it removes it, but I cannot get the values from the table (that are in %). I get this message:

Function REGEXREPLACE parameter 1 expects text values. But '0' is a number and cannot be coerced to a text.

Does anyone know how to help me? You can say if it is a bad way to solve the problem as well, then I'll try to find another solution.

Thank you!

CodePudding user response:

regex formulae in google sheets does not support numeric values/numbers. you will need to convert it into plain text. you can use

TO_TEXT()

or just attach

&""

in your case try:

=ARRAYFORMULA(REGEXREPLACE(QUERY(DATA!A1:N31)&""; "[*]"; ))
  • Related