Google spreadsheets conditional formatting if text contains numbers - google-sheets

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.

Related

How to change to a specific domain on each cell in Sheets

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."

Conditional Formatting with 2 Sheets not working

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)

Is it possible to assign conditional formatting to a named range in Google Sheets?

I'd like to apply a conditional formatting rule to a named range. Is that even possible? How do I do that? When trying to enter the Name of the Range to the Field where you set up the range the rule applies to it won't accept my input.
Also with INDIRECT it does not work:
this is not possible in Google Sheets
for the custom formula you need to wrap it into INDIRECT formula like:
I think it is not possible, it is not documented in official docs.
Range names:
Can contain only letters, numbers, and underscores.
Can't start with a number, or the words "true" or "false."
Can't contain any spaces or punctuation.
Must be 1–250 characters.
Can't be in either A1 or R1C1 syntax. For example, you might get an error if you give your range a name like "A1:B2" or "R1C1:R2C2."
The following works for my specific use case, where the named range is an "unknown" number of rows.
In this case, A1 is a column heading, and is not part of the named range.
A2:A5 is currently assigned to the named range, CitationType.
Conditional formatting is applied to A1:A based on the formula:
=and(row(A1)>1,row(A1)<=1+rows(indirect("CitationType")))
I did not find an easy way (without scripting) to get the address details of a named range, allowing for "arbitrary" usage in conditional formatting.
For custom formulas in Sheets conditional formatting, the formula usually accesses a column value in the first row of the format range. Named range values can be used in custom formulas using INDIRECT function.
example from my case ... a list of "brackets" in a tournament. Bracket rows are coloured depending on what bracket the row is for (e.g. brackets 1-10), that value is in the E column.
The formula specifies the appropriate column in the first row of the range (row is relative as conditional formatting iterates over the range). Since my range is B2:G1005, the formula references cell $E2 (the bracket ID) and compares it to the bracket id stored in a named-range location (BID_1), so custom formula is:
=$E2=INDIRECT("BID_1")
(if bracket matches the ID assigned to bracket 1 -- colour the cells grey with bolded black text).
Screenshot of conditional formatting using a named range

Creating a google sheets sumif with case-insensitive criteria

I am trying to create a SUMIF with a case-insensitive criteria (.ie contains, but not necessarily match).
Currently testing for a date range and one criteria. I would like to add one more criteria that checks for text contained in a cell in column 'Time Entry'!$J$2:$J$5993.
SUMIFS('Time Entry'!$G$2:$G$5993,'Time Entry'!$K$2:$K$5993,$A6,'Time Entry'!$D$2:$D$5993,">=" & $A$2,'Time Entry'!$D$2:$D$5993,"<=" & $B$2)
Any ideas?
SUMIF is already case insensitive, if you want to match something "contains, but not necessarily match" you can use wildcards.
? to match any single character
* to match any sequence of characters
So this will match any cell that contains "christmas" (or "Christmas" or "CHristmas" etc.)
=SUMIF(A1:A99,"*christmas*",B1:B99)
If you want to get your search value itself from a cell you can write it like this (if your value was in C1):
=SUMIF(A1:A99,"*"&C1&"*",B1:B99)
If your are looking for an actual question mark or asterisk, escape it with the tilde like this: ~? or ~*.
(late answer and not sure if the OP was looking for this but maybe conventient for future visitors)

format rows in google sheets based on conditional range

I have a data set with 77 rows. One of the columns (let's call it C) contains a name value. I would like to highlight the row if the name in column C is found in a list of names in another column.
Currently, I'm able to check only a single value, instead of a list of values. In conditional format rules, I'm able to enter the following formula
=$C:$C=$GU$1
This, of course, only checks the value against the first name in column GU. I tried to add :$GU$100 to the condition, but that won't work as the condition is now checking if the entry is the same as the entire value from GU1:GU100.
I thought I might try to use a FIND() method to see if the substring were in the larger string. To do that, I attempted the following:
=$C:$C=IF(ISNUMBER(FIND($C$1,$GU$1:$GU$100)),1,0)
While this did not return an error, it also did not highlight any rows. I'm unsure how to format one row based on whether or not the value in that row is an entry in a list elsewhere. Any ideas?
Please select your 'entire row' range (here assumed ColumnsA:G) and Format, Conditional formatting..., Format cells if..., Custom formula is:
=match($C1,$H:$H,0)
choose your Formatting style and Done. Where ColumnH is assumed to have your list.
You can add conditional formatting like this with the custom function option and applying to column C, pretending that the list with names your matching against is in column J:
=IF(ISTEXT(VLOOKUP(C1:C,J:J,1,false)),TRUE,FALSE)

Resources