=index(split("A (2)"," "),2)
renders as -2
even when cell number format is set to "Plain text". It also breaks further functions like REGEXREPLACE
that expects text, not a number.
This thread discusses similar problem, but =index(arrayformula(To_Text(split("A (2)"," "))),2)
also renders -2
. It also suggests to temporarily replace -
with |
, but that feels hacky, unreliable and non-future-proof.
How do I do text processing using Google Sheets' formulas without surprises, without the weak types feeling?
REGEXEXTRACT("A (2)","\(\d\)$"
to pull it out.REGEXEXTRACT
seems to always return a string. But I'm assuming that you are pertaining specificlaly toSPLIT
?