Conditional formatting based on cells matching a column of another sheet - google-sheets

I've got a spreadsheet made on Google Sheets that contains 11 sheets, and each sheet is a set of things that I'm considering buying.
Some sets contain the same individual pieces as something else.
For example item A might be on sheet A and sheet D.
I'd like to make some kind of formula to highlight all duplicates, so that when I was looking through the sheet I could see whether buying item A will help me complete more than just the set that I'm looking at. So I can look at a set and if it's mostly green I know there's more value in buying it as almost all of the contents will also go towards another set.
I know how to do it so that they glow if they match on the same sheet.
$A2=$B2
However I'm not sure how to do it across sheets, or how I'd include if statements. As the colour would have to change if it matches any cells in column A on any sheet. They're also not in the same order on different sheets so while item A might be in A3 on sheet A, it might be in A17 on sheet D.
I'm not sure how possible something like this is, but I'd appreciate any help.

Google Sheets does not allow direct references to cells in other sheets in conditional formatting formulas. But this can be circumvented with indirect:
= A2 = indirect("Sheet2!A2")
formats the current cell (A2) if it's the same as the contend of A2 on Sheet2.
But you want to check whether the content is duplicated anywhere in column A of another sheet. This can be done with match: select the column A2:A of the present sheet, and add conditional formatting with custom formula
=match(A2, indirect("Sheet2!A2:A"), 0) > 0
Here match returns either the position of found element (a positive number) or #N/A, and the formula evaluates to True in the former case only.
Although the formula says "A2", it can be applied at once to any range that has A2 as its upper left corner.

Related

Conditional Formatting Row based on

I like to use Google Sheets to keep my list of stories that I'm working on organized
like in this photo here:
Each row is highlighted a certain color depending on the value of the cell in "B" Column. "Published" is green, "WIP" is orange, where for range A2:B2, =B2="Published"
But at the moment I have to create the conditional formatting formula (CF) for each row one by one. I have to make the CF for Row 2, then copy the CF to Row 3 and edit the formula to replace every B2 with a B3 so it works independently on the next row.
This seems far too tedious to do practically so I was wondering if there was a formula that would allow each row to be formatted individually with one formula? Something where the formula knows to look at B2 in Row 2 to apply the formatting, B3 in Row 3, and so on.
The current formula I'm using is [=B3="Published"] to change the formatting style to a green highlight. But if I do this on all of my cells, it will change all of rows based on the value of B2. Even though in B3 it might be "WIP" instead, which defeats the purpose of highlight. I was hoping it would function like [if: =BX="Published"/ then: apply conditional formatting to Row X]
I'm really sorry about the poor phrasing of this question, I have basically zero knowledge on Google Sheets and don't know how to phrase the question for Google or any other search engine
set your range to A2:F and use this set of formulae:
orange
=$B2="WIP"
blue
=$B2="Outline"
green
=$B2="Published"

IF and REGEXMATCH formula excluding RR in a column but select for letters K-Z

So, I have a formula graciously shared by someone here that works amazing in highlighting cells in a column that contains letters from K to Z, excluding RR. Here it is below...
=REGEXMATCH(E5:E,"[K-Z]")*(REGEXMATCH(E5:E,"RR")=FALSE)
But, I'm trying to accomplish the same thing with an IF formula (not conditional formatting), where if a cell in column E contains a letter from K-Z, it will display the green checkbox, and if not, display the red down arrow. I'm not sure exactly how to exclude RR again in the equation. Here's the formula I'm trying to get to work...
={"OL";ARRAYFORMULA(IF(E5:E="",,if(REGEXMATCH(E5:E,"K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z"),"✅","🔻")))}
The formula works except it includes cells containing RR, I guess because R is in there? But I want to exclude cells containing RR.
Here's a Google Sheet that contains the formula I'm currently using.
Thanks for any help you can provide.
I left a new sheet ("Erik Help") with a formula in B1 that somewhat follows the form of your original formula there, since that seems to be something you understand. All I did was add another outer IF to rule out instances of "RR" up front:
={"OL";ARRAYFORMULA(IF(A2:A="",,IF(A2:A="RR","🔻",IF(REGEXMATCH(A2:A,"[K-Z]"),"✅","🔻"))))}
use:
={"OL"; INDEX(IF(
REGEXMATCH(E5:E,"[K-Z]")*(REGEXMATCH(E5:E,"RR")=FALSE),
"✅", "🔻"))}

Google Sheets formula to be applied in rows where there is only numbers

I have a Google Sheets workbook, have lot of data in it in the following way as shown in the picture:
So What I want to do is to highlight all rows in which LDCP > Current (Displayed in green), that is fine when I use conditional formatting and add a formula. But since there are 1000s of such rows, what I want to do is to select all and apply that formula however when I do that it highlights the rows with text such as Leasing Companies and Leather & Tanneries.
Is there a way that I can select the whole sheet and apply a formula which only is applicable where the B column (LDCP) and F Column (Current) consists of numbers. This way only those rows will be highlighted and not the other ones.
Any other kind of advice to do this would be appreciated as well.
Regards,
~K
Try this in your conditional formatting custom formula:
=and($B1>$F1,isnumber($B1))
Range A1:Fnnn where nnn is the end of your sheet.

Highlight values that are present in a range in another sheet

I'm making a Google Sheets that has a few pages, to keep track of turn-based game data. Right now, I have a sheet called Current which has a range (B5:J25) of values (all text). I have a second sheet (TurnActions) that has another range (B5:J25, again) of values.
Say the first sheet contains the values Finite, Alexander, and Trackpad in various locations, and the second contains Hamster, Finite, and Flow. I want Finite to be highlighted.
How would I use conditional formatting rules to add a red background to any values in the second sheet that are present in the first sheet?
Please try clearing formatting from and selecting TurnActions!B5:J25 and Format, Conditional formatting..., Format cells if... Custom formula is and:
=countif(importrange(" k e y ","Current!B$5:$J$25"),B5)>0
Then select red fill and Done.
A conditional format rule cannot reference a different sheet directly but we 'cheat' and use IMPORTRANGE to fetch what we need. Hence permission must be granted, to access the other sheet.
k e y is whatever is appropriate for your sheet Current.
Use delimiters appropriate for your locale.
COUNTIF

Conditional Formatting from another sheet

I'm trying to have a cell on Sheet A check if it's either > or < the value in a cell on Sheet B, then change its color accordingly. Under the custom formula I use: =A1>("SheetB!A1"), but it doesn't seem to work. I use the color Green for the > and the color Red for the <. Every time the rules are saved it will always display A1 on Sheet A in red.
Is the function wrong? Or is it not possible to have a Conditional Format even search across sheets?
For some reason (I confess I don't really know why) a custom formula in conditional formatting does not directly support cross-sheet references.
But cross-sheet references are supported INDIRECT-ly:
=A1>INDIRECT("SheetB!A1")
or if you want to compare A1:B10 on SheetA with A1:B10 on SheetB, then use:
=A1>INDIRECT("SheetB!A1:B10")
=A1>INDIRECT("SheetB!"&CELL("address",A1))
applied to range A1:B10.
You can do this by referencing the cell and row number in the current sheet, so as you drag-copy that conditional formatting to other rows it will reference the correct cells.
In the below equation I am coloring cells based on the exact same cell in some other sheet named "otherSheetName" in this example. If for example you want to color cell B2 in Sheet2 if the cell B2 in otherSheetName contains the text "I Like Dogs" you would go to cell Sheet2!B2 , click condition formatting, choose equation from the drop down and paste the below equation.
=IF(INDIRECT("otherSheetName!"&ADDRESS(ROW();COLUMN()))="I Like Dogs";1;0)
Comparing strings instead of numbers for a conditional formatting rule, you can use:
=EXACT(A1,(INDIRECT("Sheet2!A1")))
Case sensitive.
There is one trick/bug: if you have conditional formatting in Sheet1 that explicitly references itself (e.g., the formula is Sheet1!$C$2), you can copy the conditional formatting to Sheet2 with Paste special > conditional formatting and it will "work"... as long as you don't touch anything:
if you try to edit the conditional formatting in Sheet2, then you'll get an "Invalid formula" error.
if columns/rows change in Sheet1 such that they affect the conditional formatting (e.g., row/column inserts), this is not reflected in Sheet2 (keep in mind that the indirect trick mentioned by #AdamL will also not reflect column/row updates either, so it's a wash in this respect).
I was able to compare two sheet and highlight the differences on the second sheet using conditional formatting :
=A1<>(INDIRECT("Sheet1!"&Address(Row(),Column(),)))

Resources