0

my number set looks like this example -360.132, 125, 140.0152, -400.13, i would like to be able to have an if statement for the numbers that end with a "2" after the decimel point. So i want to grab -360.132 and 140.0152 and ignore the others in the above numbers. I know very little about regular expressions. I tried =ARRAYFORMULA(REGEXMATCH(E3:E105,\d$2)) where column E contained my number set but get an error.

1 Answer 1

1

Use filter() to get the values that match a regular expression, converting numbers to text strings with trim(), like this:

=filter(E3:E105, regexmatch(trim(E3:E105), "\.\d*2$"))

To learn the exact regular expression syntax used by Google Sheets, see RE2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.