I would like the row of Sheet 1 to be highlighted Red if Column K (Sheet 1) matches Column K (Sheet 2) and Column D (Sheet 2) says "Apple". I will have three variables in Column D to trigger three colors. For example, Apple = Red, Banana = Yellow, and Lime = Green.
What would the conditional formatting be if I wanted to highlight the entire row based on two variables?
Please try selecting the columns to be formatted (say A:Z) Sheet 1, Format > Conditional formatting..., Custom formula is:
=and(match($K1,indirect("Sheet 2!$K:$K"),0)>0,indirect("Sheet 2!$D:$D")="Apple")
with red formatting of your choice. Range: should show A:Z (extend as required).
Then + Add another rule as above for each of "Banana" and "Lime" in place of "Apple" with yellow and green to suit.
Related
I'm trying to get a cell to highlight with a certain color if the text of two other cells match. Has anyone else done this?
Example:
If the value in the cell A2 is "Car" and the value "Car" is in a range on another sheet, can the cell B2 be filled with a color?
Assuming a range on another sheet is ColumnC of Sheet2, then select B2, apply the Conditional Formatting custom formula:
=match(A2,indirect("Sheet2!C:C"),0)
and certain colour fill.
This can be achieved using conditional formatting.
Select the cell (B2 in your example) and in the menu bar go to Format > Conditional Formatting...
Here you want to use a custom formula. Specifically for your example, the formula to input would be:
=AND(A2="Car",COUNTIF(C2:C5,"Car")>0)
Note that the range that is being checked for "Car" is C2:C5, since you didn't specify any for your example.
EDIT:
Following the discussion in the comments:
=COUNTIF(Sheet2!$C:$C,A2)>0
What this does, is that it looks for the value in A2 in column C in Sheet2 and if it occurs once or more, the cell that you have applied this conditional formatting to, will be coloured.
I have a column(A) with cells of words where I want to highlight words that are used in other Columns containing sentences not single words. How is this possible?
With conditional formatting and a custom formula
=regexmatch(B1, join("|", filter($A:$A, len($A:$A))))
it worked that the cells in Column B or C where highlighted whenever they used a word from the cells of column A, but I need it the other way around.
Cells in column A should be highlighted whenever words from there are used in sentences in Column B or C
In this example, Column A contains the words and the words should be highlighted if they are used in Sentences in all rows of Column B or C.
Column A:
Sausage
Wiener
Brat
Column B:
I like Sausage
I don't like Steaks
Column C:
I like Brat
Here is my public Spreadsheet:
https://docs.google.com/spreadsheets/d/1ARDvwRJAPG4uXL-IyT4Qv3P0RQMFDj4OviM3GKK5Blg/edit#gid=0
=AND(LEN(A2),SUMPRODUCT(IFERROR(FIND(A2,$B$2:$E$3))))
Apply to:
A2:A
I believe, this Custom Formula for the range B2:B1000 should work:
=AND(LEN(A2),SUM(ArrayFormula(--REGEXMATCH(B2:E2,A2)))>0)
Select the cells you want to format.
Click Format and then Conditional formatting.
Under the "Format cells if" drop-down menu, click Custom formula is.
Click formula and add the formula
Click Done.
Instructions
Notes:
Check LEN(A2) to skip empty values
ArrayFormula(--REGEXMATCH(B2:E2,A2)) will return all matches with RegexExtract. Double minus -- is to convert boolean true to 1, and false to 0.
second condition SUM gives 1 and more if at least one match was found.
I'm making a spreadsheet journal with :
- a main entry on sheet1
- a static list of names and data on sheet2
In sheet1 I input values through Data Validation based on names in sheet2. Later on I add a value in sheet1. This value needs to be compared to a minimum and maximum value, that is listed in sheet2, and then color coded through conditional formatting based on a % deviation from the values in sheet2. For instance:
In sheet1 I have the data:
A B
1 value OG
2 British Brown Ale 1.045
value British Brown Ale is input through the dropdown populated from the Data Validation list. In B2 I have a value for "OG" being 1.045.
In sheet2 the data looks like:
A B C
1 value min OG max OG
2 British Brown Ale 1.040 1.052
In the row with "British Brown Ale":
in column 2 ("Min OG") I have a value of 1.040
in column 3 ("Max OG") I have a value of 1.052
Desired Result
I need to make:
the range from 1.040 to 1.052 100% within the range and color code that green,
If the value in sheet1!B2 was for instance up to 10% outside of this range it would be color coded yellow,
and over 10% would be color coded red.
How do I use conditional formatting that can compare values like above?
Will I need scripts to achieve this?
It's possible doing with only formulas. The best way is to use only ArrayFormula in order to make all formulas espand automatically.
Sheet2
Add two columns: "min - 10%" and "max + 10%"
in cell D2:
=ArrayFormula(OFFSET(B2,,,COUNTA(A2:A))/1.1)
in cell E2:
=ArrayFormula(OFFSET(C2,,,COUNTA(A2:A))*1.1)
The result:
Sheet1
4 formulas to get "min", "max", "min-10%", "max+10%"
in cell C2:
=ArrayFormula(VLOOKUP(OFFSET(A2,,,COUNTA(A2:A)),sheet1!A:E,2,0))
in cell D2:
=ArrayFormula(VLOOKUP(OFFSET(A2,,,COUNTA(A2:A)),sheet1!A:E,3,0))
in cell E2:
=ArrayFormula(VLOOKUP(OFFSET(A2,,,COUNTA(A2:A)),sheet1!A:E,4,0))
in cell F2:
=ArrayFormula(VLOOKUP(OFFSET(A2,,,COUNTA(A2:A)),sheet1!A:E,5,0))
And one formula to have color:
=ArrayFormula(if(--(OFFSET(B2,,,COUNTA(A2:A))<OFFSET(E2,,,COUNTA(A2:A)))+B2>F2,"red",if((OFFSET(B2,,,COUNTA(A2:A))>=OFFSET(C2,,,COUNTA(A2:A)))*(+OFFSET(B2,,,COUNTA(A2:A))<=OFFSET(D2,,,COUNTA(A2:A))),"green","yellow")))
The result:
Conditional Formatting rules for Sheet1
Select column B, add 3 new conditional formatting (CF) rules, custom formula:
first, paint green:
=$G1="green"
next, paint yellow:
=$G1="yellow"
next, paint red:
=$G1="red"
Then wou may hide extra columns.
The result:
I think, that's all is possible to do with only 3 huge arrayformulas inside CF, without doing extra columns, but it's hard to build one.
I'd like to use Conditional Formatting in Google Sheets to color in a whole line based on certain criteria:
Color the line red if Column D contains a specific Value AND Column L is not empty AND Column S is empty.
Color the line green if Column D contains a specific value AND Column L is not empty AND Column S is also not empty
Do not color the line if Column L is empty, regardless of whether Column D or S have values.
So far, here's what I've tried:
=$D:$D = "specificValue"
This will color in any line in which Column D contains the specific value
=$D:$D = "specificValue" & $S:$S
This will color in any line where D contains the specific value and Column S is empty. Close, but not quite what I need.
=$D:$D = "specificValue" & $S:$S <> ""
This will Color in the whole range that I am applying the conditional formatting to.
=$D:$D = "specificValue" & $S:$S & $L:$L
This will color in any line where Column D is the value, AND BOTH Columns S and L are empty. A value in either S or L will make this line not colored. This is problematic. If D AND S have values but not L then it doesn't need to be colored. If D and L have values but not S then it needs to remain colored until I have S filled in.
Please select all the relevant cells in your sheet and Format, Conditional formatting..., Format cells if..., Custom formula is enter:
=and($D1="specificvalue",not(isblank($L1)),isblank($S1))
and for Formatting style choose red fill, Done.
Then repeat with Add new rule:
=and($D1="specificvalue",not(isblank($L1)),not(isblank($S1)))
with green fill.
The formulae are a little more verbose than really necessary but hopefully make it more obvious what is happening, as I suspect you might need to make some adjustment. Note that formatting an entire sheet may be slow. You might want to turn "specificvalue" into an absolute reference to a cell containing specificvalue.
I want to format cells in column C based on the value for column B.
For instance:
B
.75
.75
.5
.25
When column C gets a value. I want the cell color to change to represent a < = or > value, like so:
C
.75 = green
.5 = yellow
.25 = red
.25 = green
How can I do this without putting in a formula specific to each cell? There could be any number of cells.
Start with one cell. Go to Format -> Conditional formatting. Do your three rules (if C1 greater than B1, fill green, etc.):
Select the cell you wish to edit.
Under Format -> Conditional formatting:
The Conditional Formatting Window will open. You can select the rule you would like and add a formula as shown.
After each one, there is a button at the bottom of the dialog for Add another rule. Make sure that you don't use fixed (=$B$1) references in your formulas, but relative ones (=B1). Once you have all three rules, click done. Test it to make sure it works like expected.
Now all you have to do is select the cell that has the conditional format (C1) and click the Format Painter tool. Then just highlight any cells that you want to follow the same rules. Because you have relative references, the conditional formatting will shift (i.e. C2 will reference B2 and D2 will D1 will reference C1).
Google does all the hard work :)
Does that make sense?