emails
vera#mail.com
estebangarrido#mail.c
hurtado#mail com
jmariano2mail.com
How can I pass a fuction which correct all domains to #mail.com. I know I have to use =RIGHT(,9) but when you reach the last error it does not apply
Try below formula-
=ArrayFormula(IF(A2:A="",,QUERY(SPLIT(SUBSTITUTE(SUBSTITUTE(A2:A,"mail","|"),"#",""),"|"),"select Col1",0)&"#mail.com"))
This should also work.
=INDEX(IF(LEN(A2:A),QUERY(SPLIT(SUBSTITUTE(SUBSTITUTE(A2:A,"mail","|"),"#",""),"|"),"select Col1")&"#mail.com",""))
Answer
The following formula should produce the results you desire. It assumes that the data you provide is in cells A2:A5 of your spreadsheet. If this is not the case, adjust the A2:A5 portion of the formula appropriately.
=ARRAYFORMULA(REGEXREPLACE(A2:A5,"[#|2].*","#mail.com"))
Explanation
This formula uses REGEXREPLACE to get rid of all rogue characters and replace them with #mail.com. The first argument of REGEXREPLACE is the string to be evaluated. In this case, that is the range from A2 through A5. The second argument is which characters to look for. In this case that is all characters (done using .*) that follow either an at-sign or a numeral two (done using [#|2]). The third argument is which new string to replace the found characters with. In this case that is #mail.com, the correct domain without typos.
The REGEXREPLACE is wrapped in =ARRAYFORMULA because normally REGEXREPLACE can only be used with a single cell rather than a range of cells.
Please note that this solution relies on the assumption you stated that "Everything before # or 2 is correct."
Related
Ideally what I'm looking for is to get the dollar amount extracted no matter the format.
Sheet link:
https://docs.google.com/spreadsheets/d/1drTPlnQmVTsbUXwJDfQr7DnHjSbnGx-fLthad6KxfM8/edit?usp=sharing
Delete everything from Column B, including the header. Then place the following formula in cell B1:
=ArrayFormula({"Header"; IF(A2:A="",,VALUE(IFERROR(REGEXEXTRACT(A2:A,"\$(\d+\.?\d*)"))))})
You may change the header text within the formula as you like.
If a cell in A2:A is blank, the corresponding cell in B2:B will be left blank as well.
Otherwise REGEXEXTRACT will look for a pattern that begins with a literal dollar sign. The parenthesis within the quotes denote the beginning and end of a capture group (i.e., what will be returned if found) following that literal dollar sign. The pattern \d+\.?\d* means "a group of one or more digits, followed by zero or one literal period symbols, followed by zero or more digits."
IFERROR will cause null to be rendered instead of an error if such a pattern is not able to be extracted.
VALUE will convert the extracted string (or null) to a real number.
If you would prefer that null be returned instead of 0 where no pattern match is found, you can use the following variation of the formula instead:
=ArrayFormula({"Header"; IFERROR(VALUE(IFERROR(REGEXEXTRACT(A2:A,"\$(\d+\.?\d*)"),"x")))})
If your strings may include numbers with comma separators, use the following versions of the above two formulas, respectively:
=ArrayFormula({"Header V1"; IF(A2:A="",,VALUE(IFERROR(REGEXEXTRACT(SUBSTITUTE(A2:A,",",""),"\$(\d+\.?\d*)"))))})
=ArrayFormula({"Header V2"; IFERROR(VALUE(IFERROR(REGEXEXTRACT(SUBSTITUTE(A2:A,",",""),"\$(\d+\.?\d*)"),"x")))})
try:
=INDEX(IFNA(REGEXEXTRACT(A2:A, "\$(\d+.\d+|\d+)")*1))
So I have a document with 30k+ emails. The probleme is, during the export random characters appeared after the emails, something like name#email.com2019-10-10T0545152019-10-10T054515f or name#email.com00000000000700392019-11-28T070033f
My question is, how do i remove everything after ".com" or ".fr" in all the cells ?
You could try using REGEXREPLACE.
=REGEXREPLACE(A1,"\.com.*|\.fr.*", "")
Try
=REGEXEXTRACT(A1,".+\.com|.+\.fr")
Working from what other people added, you can get all emails from the column A and use regular expressions to get the values. Using ARRAYFORMULA you can do it in a single formula:
=ARRAYFORMULA(IF(A:A<>""; REGEXEXTRACT(A:A; ".+\.(?:com|fr)"); ""))
Rundown
ARRAYFORMULA allows to execute the formula to the entire column
REGEXEXTRACT extracts part of the string using regular expressions
IF conditional. In this case it's used to no execute when the cell is empty, preventing an error.
References
ARRAYFORMULA (Docs Editor Help)
REGEXEXTRACT (Docs Editor Help)
IF (Docs Editor Help)
Supposing your raw-data email list were in A2:A, try this in, Row 2 of an otherwise empty column (e.g., B2):
=ArrayFormula(IF(A2:A="",,REGEXEXTRACT(A2:A,"^.+\.\D+")))
In plain English, this means "Extract everything up to the last dot found that is followed by some number of non-digits."
This should pull up to any suffix (e.g., .com, .co, .biz, .org, .ma.gov, etc.).
im trying to mark matching URLs red.
I have two sheets with URL Data.
My custom Formula looks like this:
match(A2,indirect(Sheet2!A2:A),0)
wondering why there is an error if i use =match(A2,indirect(LostURLs!A2:A),0)
so with the additional =
Anyways both methods are not working and im wondering why?
Indirect excepts the first argument to be "a cell reference as string".
So please try
=match(A2,indirect("LostURLs!A2:A"),0)
and see if that works?
Note: depending on if you want the formatting for a single cell, a column or a row you may have to use a dollar sign in the first argument of the match() function
E.g: If you'd want to repeat the formatting for column A, you would have to use
=match($A2,indirect("LostURLs!A2:A"),0)
For row 2 that would be:
=match(A$2,indirect("LostURLs!A2:A"),0)
and for a single cell
=match($A$2,indirect("LostURLs!A2:A"),0)
NOTE: Depending on your locale, you may have to change the comma's to semi-colons.
perhaps try:
=MATCH(A2; INDIRECT("LostURLs!A2:A"); 0)
I have a sheet containing my weekly schedule. Only school cells have a room number in it, so how do I format the cells to color only the ones that contain a number.
note: Actually, the room number is a number in range(A:E) followed by a three digits number in range(000:499). Ex.:(A433, B166, D254)
I tried: Text contains"(A:F)(000:444)" but it didn't work.
EDIT:
For some reason, "=REGEXMATCH(B2, "[A-F][0-9]{3}")" worked. Could anyone tell me why? I tried replacing B2 by B1, but then it didn't work. Does it have anything to do with the fact that B1 is a weekday, and so does not contain REGEXP(B1,"[A-F][0-9]{3}) returned false.
What seemed more logical to me was "=REGEXMATCH(B2:F22, "[A-F][0-9]{3}")" To apply this function in range B2 to F22. What am I missing here?
In order to match patterns, you'll need to use regular expressions. Since the standard Conditional Formatting options don't include regular expressions, you'll need to choose "Custom formula is" and then use REGEXMATCH, which returns a Boolean value.
If you really want to look for the specific room number format you mentioned, then you would use the formula:
=REGEXMATCH(A1, "[A-E][0-9]{3}")
But if you just want to look for any numbers, you can use
=REGEXMATCH(A1, "[0-9]+")
In both cases, the text you're checking is in cell A1
You might try Conditional Formatting with a custom formula rule of the type:
=if(isnumber(A1),1,regexmatch(A1,"\d"))
The above was an attempt to respond to:
Google spreadsheets conditional formatting if text contains numbers
A more particular fit for the stated room number style would be:
=REGEXMATCH(A1,"[A-F]\d\d\d")
where the first character is any of the first six letters of the alphabet, if capitalised, followed by three instances of any number.
I have a column XXX like this :
XXX
A
Aruin
Avolyn
B
Batracia
Buna
...
I would like to count a cell only if the string in the cell has a length > 1.
How to do that?
I'm trying :
COUNTIF(XXX1:XXX30, LEN(...) > 1)
But what should I write instead of ... ?
Thank you in advance.
For ranges that contain strings, I have used a formula like below, which counts any value that starts with one character (the ?) followed by 0 or more characters (the *). I haven't tested on ranges that contain numbers.
=COUNTIF(range,"=?*")
To do this in one cell, without needing to create a separate column or use arrayformula{}, you can use sumproduct.
=SUMPRODUCT(LEN(XXX1:XXX30)>1)
If you have an array of True/False values then you can use -- to force them to be converted to numeric values like this:
=SUMPRODUCT(--(LEN(XXX1:XXX30)>1))
Credit to #greg who posted this in the comments - I think it is arguably the best answer and should be displayed as such. Sumproduct is a powerful function that can often to be used to get around shortcomings in countif type formulae.
Create another list using an =ARRAYFORMULA(len(XXX1:XXX30)>1) and then do a COUNTIF based on that new list: =countif(XXY1:XXY30,true()).
A simple formula that works for my needs is =ROWS(FILTER(range,LEN(range)>X))
The Google Sheets criteria syntax seems inconsistent, because the expression that works fine with FILTER() gives an erroneous zero result with COUNTIF().
Here's a demo worksheet
Another approach is to use the QUERY function.
This way you can write a simple SQL like statement to achieve this.
For example:
=QUERY(XXX1:XXX30,"SELECT COUNT(X) WHERE X MATCHES '.{1,}'")
To explain the MATCHES criteria:
It is a regex that matches every cell that contains 1 or more characters.
The . operator matches any character.
The {1,} qualifies that you only want to match cells that have at 1 or more characters in them.
Here is a link to another SO question that describes this method.