Conditional formatting with custom formula - google-sheets

I cannot seem to make my conditional formatting work with a custom formula. The long and short of it is that the formatting is based on some VLOOKUPs. I've tested the formula in a normal cell and it outputs 1 as expected.
=IF(REGEXMATCH(VLOOKUP(C5,CL!C2:H99,5,FALSE), VLOOKUP(B5,CL!J3:K110,2,FALSE)), 1, 0)
I'm basically testing to see whether a certain tag is included in a cell that contains a comma separated list of tags.
The documentation seems to suggest that I need to enter the formula into the box with quotation marks around it (""). I've tried all variations I believe.
I've also tried removing the IF statement, as REGEXMATCH outputs true or false.
Any clue why this isn't working?

when attempting conditional formatting to reference another sheet you need to wrap it into INDIRECT - that's where Google documentation failed. try:
=IF(REGEXMATCH(VLOOKUP(C5, INDIRECT("CL!C2:H99"), 5, 0),
VLOOKUP(B5, INDIRECT("CL!J3:K110"), 2, 0)), 1)

Related

Highlight duplicated values in many cells in Google Sheets

I have dozens of columns where I want to highlight duplicates. I have an issue with the formula. Here is what I have:
=COUNTIFS($B$3:$B,$C$3:$C,$D$3:$D,$E3:$E,$F3:$F,$G$3:$G,$H$3:$H,$I$3:$I,$J$3:$J,$K$3:$K,$L$3:$L,$M$3:$M,$N$3:$N,$O$3:$O,$P$3:$P,$Q$3:$Q)>1
I have also tried this:
=COUNTIFS($B$3:$B,$B3:$B,$C$3:$C,$C3:$C,$D$3:$D,$D3:$D,$E$3:$E,$E3:$E,$F$3:$F,$F3:$F,$G$3:$G,$G3:$G,$H$3:$H,$H3:$H,$I$3:$I,$I:$I,$J$3:$J,$J3:$J,$K$3:$K,$K3:$K,$L$3:$L,$L3:$L,$M$3:$M,$M3:$M,$N$3:$N,$N3:$N,$O$3:$O,$O3:$O,$P$3:$P,$P3:$P,$Q$3:$Q,$Q3:$Q)>1
Google sheets says: Invalid formula. What is wrong with it? Is there an easy way of doing it instead of typing all the columns one by one?
Apply a custom formula for conditional formatting.
If you want to check everything from row 3 to the very bottom then use
=COUNTIF($B$3:$S, B3) > 1
applied to B3:S.
If you want to handle only the range B3:S22 then apply to it:
=COUNTIF($B$3:$S$22, B3) > 1
Do not forget those $s.
try:
=REGEXMATCH(""&B3, TEXTJOIN("|", 1, $B$25:$B$28))

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)

Trouble searching combined ranges in HLOOKUP

I'm having trouble with HLOOKUP in Google Sheets. I'm trying to determine whether an inputted word is unique in a row and for this reason my formula searches combined ranges [that exclude itself] within an HLOOKUP. This is the formula I'm using [in cell E4]:
=HLOOKUP(E2, {B2:D3;F2:M3}, 2, false)
Doubtless, there's something I'm doing wrong, because I keep getting this error:
"HLOOKUP evaluates to an out-of-bounds range"
What I want to happen is that it will find a match for "ice" in the range to the left [B2:D3] and the range to the right [F2:M3]...
Confusingly, the equivalent formula works for VLOOKUP, but not HLOOKUP. I've found it also works in HLOOKUP if I search for a single range [ie B2:D3] and not a combined range.
So I'm a bit stuck. The combined range search works fine in VLOOKUP, but perhaps I need to write it differently for HLOOKUP?
Any help would be greatly appreciated.
instead of this:
=HLOOKUP(E2, {B2:D3; F2:M3}, 2, 0)
try this:
=HLOOKUP(E2, {B2:D3, F2:M3}, 2, 0)
For identifying duplicates conditional formatting might suit you. Select all relevant columns : Format > Conditional formatting..., Format cells if... Custom formula is and:
=countif(1:1,A1)>1
with formatting of your choice.
This should format all instances of any value repeated in its row.

How to highlight PARTIAL matching duplicates across 1 column in Google Sheets using conditional formatting

As the title says, I'm trying to highlight partial duplicates for 1 column in Google Sheets using conditional formatting.
Here's what I have so far:
=if(C1<>"",Countif(C$1:C,left(C1,5)& "*") > 1)
This works, but the issue is the "left" makes it so the code only highlight cells that are duplicates from the start.
So for instance, the formula won't highlight "1exampletest" and "2exampletest" because the first 5 characters are not the same...which is something I want the formula to be able to highlight.
Does anyone know the right formula for detecting partial duplicates regardless of when the duplicate is occurring?
there are several ways how to do it which may or may not work for you (because you did not provide a geniue sample)
_______________________________________________________________
or with REGEXMATCH like: =REGEXMATCH(A1, "example")
_______________________________________________________________
=OR(IF(C1<>"",COUNTIF(C$1:C,LEFT(C1,5)&"*")>1),IF(C1<>"",COUNTIF(C$1:C,"*"&RIGHT(C1,5))>1))

Apply conditional formatting in Google Docs if current cell exists in a range

Very simply, I am attempting to highlight a cell if that cell matches (exactly) with a different cell from a different column (in a different sheet, specifically).
For example, I have an 'Active' and 'Inactive' sheet in my Google Docs Spreadsheet. Some of the items listed in 'Inactive' are also listed in 'Active', and I need to highlight those.
What I've gotten so far is this (that doesn't work):
Format -> Conditional Formatting
Format Cells If -> Custom Formula Is
GT(MATCH(A1, 'Active'!A2:A, 0), 0)
The general formula above works if I use it in the spreadsheet normally and correctly pass the 1st parameter to MATCH(), however when I attempt to move the regular formula to a conditional formatting, it seems to break down: I need to pass the current cell's contents as the 1st parameter, not A1 statically. If using GT() + MATCH() is indeed the correct way to accomplish this, I need a way to express:
GT(MATCH( 'Inactive'! [A + ROW()] , 'Active'!A2:A, 0), 0)
... Where A+ROW ends up being the non-literal expression, -- i.e. on row 123 this would refer to the cell contents of A123.
There may be also an easier and more intuitive way to do this altogether. To state my problem in a different way, "If the current cell's data [a string] is present (or 'matches') in the range 'Active'!A2:A then highlight it".
The problem is that when you are using a different sheet in conditional formatting you need to pass it using INDIRECT(). Use this formula in conditional formatting:
=GT(MATCH(A1, INDIRECT("'Active'!A2:A"), 0), 0)
And apply it to range A1:A. You do not need to pass the row number, google does it for you.

Resources