Conditionally format rows based on a cell value - excel-2010

I have a excel sheet contains data like below.Pno data is based on this formula =Left(B2,1), corresponding numbers displayed in Pno. I'm trying to apply coloring to entire row based on the values in the Pno.
Pno EFormat EID
1 1004 1001
1 1142 1001
2 2344 1001
3 3456 1001
4 4632 1001
1 1168 1001
4 4789 1001
5 5889 1001
If Pno=1 then rows highlited with yellow color, if pno=2 color=blue like that.
I tried rules to format the entire row based on the column A entries
=$A1="1" and pick Yellow
=$A1="2" and pick blue etc
but color is not hilighting because pno ,Eformat,EID contains formula.
How do i refer conditional formatting.

select A1:C8
click conditional formatting -> new rule -> use formula to determine which cells to format
in the formula box type : =IF(VALUE($A1)=1,TRUE,FALSE)
set fill to yellow, click OK
-
select A1:C8
click conditional formatting -> new rule -> use formula to determine which cells to format
in the formula box type : =IF(VALUE($A1)=2,TRUE,FALSE)
set fill to blue, click OK
EDIT
Thanks #Doug Glancy for your comment.
The better answer therefore is: (still works the same):
=VALUE($A1)=1

Related

Conditional Format based on values in table

How do I conditionally format each individual cell in B27:AM46 based on the table in A94:B114?
B27:AM46
a94:B114
Copy of Sheet: https://docs.google.com/spreadsheets/d/1oEOcDbQW-QRhjHDY1D04R9XNStyeTKA44GEaPrlh3sk/edit
For example, ARS is 3. Every cell that contains ARS in B27:AM46 would be red.
1 would be grey
2 would be white
3 would be red
Step 01
1 - Click Format and then Conditional Formatting.
2 - Under the "Format cells if" drop-down menu, click Custom formula is.
3 - Add new rule and then Custom formula is.
Click Value or formula and add the formula and rules. for each formula in the following table in step 02
Step 02
Paste this formula for each rule
Rules
Formula
Red
=IFNA(VLOOKUP(REGEXEXTRACT(B2,"(.+) "),$K$2:$L,2,0),"")=1
white
=IFNA(VLOOKUP(REGEXEXTRACT(B2,"(.+) "),$K$2:$L,2,0),"")=2
red
=IFNA(VLOOKUP(REGEXEXTRACT(B2,"(.+) "),$K$2:$L,2,0),"")=3
Notes
The lookup table needs to be on the same sheet.

Google Sheets hover label from different values

I am working on a Google Spreadsheet with several columns of data. I have made a chart that pits two of those columns against each other, showing that in general, when one value increases, the other one decreases. When I hover over a datapoint, it mentions the exact value of both the x- and y-axis. However, I would like it to show the value from the same row in a different column, the label of the values I'm displaying, so I can easily see where the values belong. Is it possible to customise the hover label in this way? I could not find it in the graph settings and online search did not yield any results either.
This is an impression of the sheet I have:
Label x-value y-value
aaa 130 0
bbb 110 7
ccc 100 10
ddd 50 30
eee 75 23
fff 20 42
I would like the hover to show me aaa for the first value for example.
This is the real graph with a hover label:
550
x: 49
I would like it to show the "name" of that row instead.

Conditional cell blacking

I'm trying to make a spreadsheet where there's initially 75 rows and 24 columns. Row 1 has a title of a game in it, and row 2 is blank. Then rows 3-72 and columns 2-24 are blacked out.
And when either a cell is blank for "don't own" or "1" for "own" is entered in a cell in row 2, the entire column becomes accessible. Then when the column is accessible, information in the cells is shown.
So if row 2 is blank, it will be http://prntscr.com/k6lalm. And if there is a "1" in a cell(s) in row 2, it will be http://prntscr.com/k6lbcl. (Yes, I'm making a spreadsheet for Pokémon.)
Not sure how I would go about doing a conditional format for it or using an IF statement.
I'm not certain this is what you want but suggest that if you want to 'overlay' or 'peel off' black fill from the 'data' part of each column according to whether or not the column is populated with 1 in Row 2, then select the body of your 'data' (starting from B3), clear an existing CF from the range and apply a Custom formula is of :
=B$2<>1
and select black fill. The Apply to range should be B3:X35.
Adding or clearing a 1 in Row2 should then remove or add CF black fill over the the relevant part of the relevant column. On removal of the CF fill whatever 'standard' fill (could be black) applied to the cell should be displayed.

If value bigger than 0 mark line green

I have made a guest list sheet in Google Sheets with two columns, one of name and one of attendance. The attendance column can have two values, either X (when people don't come) or a number (mostly 1 or 2, but safe to say always bigger than 0).
I've already created a custom formula marking the whole line (including the name) red if there is an X in the second column.
This formula works like a charm!
I now want to do the same thing, but making the whole line (including the name) green if there is a number placed in the column. I've tried replacing the X in the custom formula with 1, 2, 3 etc (also with colons and semi-colons) but that doesn't work.
Does any of you know what I need to do?
Please select ColumnsA:C and: Format > Conditional formatting..., Format cells if... Custom formula is and:
=and(isnumber($C1),$C1<>0)
with green fill for Formatting style and Done.
(Assumes 2 etc are Number format.)

Conditional formatting based on another cell's value

I'm using Google Sheets for a daily dashboard. What I need is to change the background color of cell B5 based on the value of another cell - C5. If C5 is greater than 80% then the background color is green but if it's below, it will be amber/red.
Is this available with a Google Sheets function or do I need to insert a script?
Note: when it says "B5" in the explanation below, it actually means "B{current_row}", so for C5 it's B5, for C6 it's B6 and so on. Unless you specify $B$5 - then you refer to one specific cell.
This is supported in Google Sheets as of 2015:
https://support.google.com/drive/answer/78413#formulas
In your case, you will need to set conditional formatting on B5.
Use the "Custom formula is" option and set it to =B5>0.8*C5.
set the "Range" option to B5.
set the desired color
You can repeat this process to add more colors for the background or text or a color scale.
Even better, make a single rule apply to all rows by using ranges in "Range". Example assuming the first row is a header:
On B2 conditional formatting, set the "Custom formula is" to =B2>0.8*C2.
set the "Range" option to B2:B.
set the desired color
Will be like the previous example but works on all rows, not just row 5.
Ranges can also be used in the "Custom formula is" so you can color an entire row based on their column values.
One more example:
If you have Column from A to D, and need to highlight the whole line (e.g. from A to D) if B is "Complete", then you can do it following:
"Custom formula is": =$B:$B="Completed"
Background Color: red
Range: A:D
Of course, you can change Range to A:T if you have more columns.
If B contains "Complete", use search as following:
"Custom formula is": =search("Completed",$B:$B)
Background Color: red
Range: A:D
I've used an interesting conditional formatting in a recent file of mine and thought it would be useful to others too.
So this answer is meant for completeness to the previous ones.
It should demonstrate what this amazing feature is capable of, and especially how the $ thing works.
Example table
The color from D to G depend on the values in columns A, B and C. But the formula needs to check values that are fixed horizontally (user, start, end), and values that are fixed vertically (dates in row 1). That's where the dollar sign gets useful.
Solution
There are 2 users in the table, each with a defined color, respectively foo (blue) and bar (yellow).
We have to use the following conditional formatting rules, and apply both of them on the same range (D2:G3):
=AND($A2="foo", D$1>=$B2, D$1<=$C2)
=AND($A2="bar", D$1>=$B2, D$1<=$C2)
In English, the condition means:
User is name, and date of current cell is after start and before end
Notice how the only thing that changes between the 2 formulas, is the name of the user. This makes it really easy to reuse with many other users!
Explanations
Important: Variable rows and columns are relative to the start of the range. But fixed values are not affected.
It is easy to get confused with relative positions. In this example, if we had used the range D1:G3 instead of D2:G3, the color formatting would be shifted 1 row up.
To avoid that, remember that the value for variable rows and columns should correspond to the start of the containing range.
In this example, the range that contains colors is D2:G3, so the start is D2.
User, start, and end vary with rows
-> Fixed columns A B C, variable rows starting at 2: $A2, $B2, $C2
Dates vary with columns
-> Variable columns starting at D, fixed row 1: D$1
Basically all you need to do is add $ as prefix at column letter and row number. Please see image below
change the background color of cell B5 based on the value of another cell - C5. If C5 is greater than 80% then the background color is green but if it's below, it will be amber/red.
There is no mention that B5 contains any value so assuming 80% is .8 formatted as percentage without decimals and blank counts as "below":
Select B5, colour "amber/red" with standard fill then Format - Conditional formatting..., Custom formula is and:
=C5>0.8
with green fill and Done.
I'm disappointed at how long it took to work this out.
I want to see which values in my range are outside standard deviation.
Add the standard deviation calc to a cell somewhere =STDEV(L3:L32)*2
Select the range to be highlighted, right click, conditional formatting
Pick Format Cells if Greater than
In the Value or Formula box type =$L$32 (whatever cell your stdev is in)
I couldn't work out how to put the STDEv inline. I tried many things with unexpected results.
I just want to explain it in a another way. In "custom formula" conditional formatting you have two important fields:
Custom formula
Apply to
Let's say, you have a simple sheet with test percentages of students, where you want to color Student Ids(Column B) where their score(Column C) > 80%:
Row
B(Student ID)
C(Score)
1
48189
98%
2
9823
6%
3
17570
40%
4
60968
23%
5
69936
7%
6
8276
59%
7
15682
96%
8
95977
31%
To design a custom formula, you only need to design a formula for the top left of the range, you want to color. In this case, that would be B1.
The formula should return
TRUE, if it should be colored and
FALSE, if it shouldn't be colored
For B1, the formula would then be:
=C1>80%
Now imagine that you put that formula in B1(Or just use a another range to test it). It would be like:
Row
B
C
1
TRUE
2
3
4
5
6
7
8
Now imagine dragging the formula(or autofill) up to B8 from B1. This is how it would look like
Row
B
C
1
TRUE
2
FALSE
3
FALSE
4
FALSE
5
FALSE
6
FALSE
7
TRUE
8
FALSE
This translates directly to color B1 and B7. Now the interesting thing is All of this is autocalculated using the given formula for B1 and the Apply to range. If you fill:
Custom formula: =C1>80% and
Apply to: B1:B8
you're saying
Fill the custom formula =C1>80%
in the top left cell of the provided range B1:B8,i.e., B1 and
drag/autofill the formula to the whole range B1:B8 and
Color the cells, where the formula outputs TRUE
If you want to color both student IDs and score, you would use
Custom formula:
=$C1>80%
Apply to:
B1:C8
The $ in the $C1 says not to change C, when autofilling the range. In the imaginary table(I suggest you to output the table somewhere). This would look like:
Row
B
C
1
TRUE
TRUE
2
FALSE
FALSE
3
FALSE
FALSE
4
FALSE
FALSE
5
FALSE
FALSE
6
FALSE
FALSE
7
TRUE
TRUE
8
FALSE
FALSE
In this way, you can color any cell anywhere based on any other cell.

Resources