Copy conditional formatting to other rows in Google Spreadsheets - google-sheets

I have set the conditional formatting for one row, in the way I want it for approx 50 other rows.
Applying the conditional formatting to each rows take too much time. Is there a script that could do this automatically?
The conditional formatting for each row (first row is 21) is that: if the date (AB20) is the same as H21, then color AB21 yellow; if the date (AB20) is the same as F21, then color AB21 green.
Thanks!

Don't copy conditional formatting: apply it to a range instead (range is entered when a conditional formatting rule is created or when it's edited). Write the custom formula as it should work for the upper left corner of the range. It will be automatically adjusted for other cells based on relative references, even though this may not be obvious.
In your case, the range should be AB21:AB and the custom formulas are either
= AB20 = H21 and = AB20 = F21 if the goal is to compare F and H of the current row with AB of the previous row.
= AB$20 = H21 and = AB$20 = F21 if the goal is to compare F and H of the current row with AB of row 20.

Related

Conditional Formatting from cells in adjacent column

[inventory sheet] (https://docs.google.com/spreadsheets/d/1kLDo8Up_RJa2rXsEZ9ElKBEhGUTsMw61-fQspOPuBz4/edit#gid=0)
I'm trying to conditionally format column E based on column D. For example, if the value in column D is <8, highlight the adjacent cell in column E green. If value is >7 and <15, highlight yellow. If value is >14, highlight red.
The formula I have now works, but I can't figure how to apply the formatting to the entire column without manually inputting 3+ conditional format rules on each individual cell.
The existing conditional format from your sheet is partially correct, it just needs some tweaking on the Apply to range value. You can create 3 conditional formats on E3 and it will apply to the whole column of E if you put the E3:E on range.
Please see the 3 conditional formats I have created based from your given sheet.
Conditional format 1:
Conditional format 2:
Conditional format 3:
Output:
Reference:
AND function
Just select the whole range and create one single rule per condition. Use the formula as it is created for the first cell and it will "drag" automatically.
For example with =D2>15

Compare range of values. Conditional Formatting

As of now, I would like to compare a range of values (different rows but same cells) and highlight them according to the result.
Let's say that we have Row A with some numbers and Row B also with numbers.
A B
10 5
20 30
30 40
I would like to use conditional formatting to highlight cells in Row B if they are greater than in Row A. Like iterate through each of them, compare A1 < B1 (A2 < B2.. A"X" < B"X") and highlight each of them if the cell is greater.
Could you support me on this? Thanks in advance!
In order to do that
Go to Format > Conditional formatting > format cell if... and Choose Custom formula. and Paste this formula in "Value or Formula". take a look at the Example Sheet.
=IF(A2:A="",,B2:B>A2:A)
Explanation
IF Range A2:A is Empty "" Do nothing ,, if isn't Empty check if B2:B > A2:A if TRUE Highlight green if FALSE do nothing.
You can use in Custom formula is
=B1>A1
OR (to take into account empty cells in column A)
=AND(B1>A1,A1<>"")

Format one row as soon as cumulative sum reaches a particular number

I have a Google sheet that shows the number of KM a vehicle ran every day. Column E is the total distance. I want to change row background to red as soon as the value in E crosses 1000. And it should apply only to that one immediate row.
How to do it?
Select A5 to wherever suits, and apply a Conditional formatting formula rule of:
=countif($E$5:$E5,">1000")=1
You can do this directly with a formula from the Conditional Formatting option.
In my example I am shading the row in the area A1:B3 based on the values in C
Use the format cells if ... custom formula is option and put the conditions you want you range to change in there.
E.g. I am formatting my range to change to green when =$C1>=1000
Notice I don't need to change C1 to include all the rows, as it will evaluation on every for separately.

Custom Conditional Formatting formula

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.

compare data from two columns in google sheets

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?

Resources