Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

How to use multiple criteria with Regexreplace in Google sheet?

$
0
0

I am trying to correct the number/expression of room numbers that are entered by users with the following:

1- If the number contains ( / or \ or _ ), it will be replaced with "-".

2- If the number contains "iso" or "Bed", it should be removed or replaced with "".

The sample sheet is https://docs.google.com/spreadsheets/d/1U-daD0CEPRLoCP7xCLT9bSMK9yN3ll8QQQfNk7-OZDs/edit#gid=1418057437.

Column A is to be entered by a user.

Column B is the result of arrayformula. The arrayformula is in B3 Cell. I couldn't add more than two regular expressions. Like, ("\|_|/").. what works is two only ("\|_").

=ArrayFormula(REGEXREPLACE((ArrayFormula(REGEXREPLACE(UPPER(A3:A),("ISO|BED"),""))),("\|_"),"-"))

It seems also complicated using two arrayformula functions in the same line.

What I want the result to be is: a number with "-" separator only. (I typed the expected results in Column C in order to modify the arrayformula to produce same result)


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>