I am using the following custom formula in conditional formatting to try and highlight the 5 lowest values in column B. However, I would like it to exclude zero values from the data. How do I highlight the lowest 5 values that are greater than zero?
=$B1<=SMALL($B$1:$B$100,$E$2)
Thank you!
https://docs.google.com/spreadsheets/d/1K-dsv3bB1qF-zhPR1XtciHmQAdOMuzrUJU4SlXz5e08/edit?usp=sharing
You can filter out the zeros before using SMALL, like this:
=AND($B1,$B1<=SMALL(FILTER($B$1:$B$100,$B$1:$B$100),$E$2))
Just an alternative added in this tab here:
highest
=xmatch($B1,sortn(filter($B:$B,$B:$B<>0),$E$1,,1,))
lowest
=xmatch($B1,sortn(filter($B:$B,$B:$B<>0),$E$2,,1,1))
Related
I am trying to color Column A based on its percentage of value in Column B. Column B value could be 3, 6, 9 or 12, so I cannot just take a raw number as the minimum, mid or maximum value, it has to be a percentage. And I would like to do this without inserting an extra column which calculates the percentage. Below is an image with how the two columns may look like.
What works is adding an extra column in which the percentage is calculated using the formula:
=TO_PERCENT(A2/B2)
with the Color Scale Conditional Formatting looking something like this:
But I don't want an extra column showing the percentage, I would rather color the numbers in Column A based on what percentage they are of Column B. What I thought would work is the following:
The formulas being:
=TO_PERCENT($A2/$B2)>=0%
=TO_PERCENT($A2/$B2)>=50%
=TO_PERCENT($A2/$B2)>=100%
With or without TO_PERCENT, as you can see, the result is the same - everything under the midpoint, which should be red, is actually green. I am unsure as to what is causing this, nor how to fix this or if there is any feasible alternative to properly color scale based on value's percentage of another value.
You shouldn't use Colour scaling like that. Consider that even if it analyses it, an expression like =TO_PERCENT($A2/$B2)>=0% will actually return 0 when false and 1 when true, so it's not going to be comparable to your columns
It's a little uncomfortable, but what you should do is to create your own scaling by setting each of your formulas to each desired colour. Keep in mind the order of the rules, the highest values should go up
I am formatting a column in a way that the 2 lowest values are painted green, with the custom formula:
=K6<SMALL($K$6:$K$44; 3)
From my understanding this takes the third lowest value and paints the ones beneath that (the two lowest) green.
This worked fine until, today we had value 168, 169.5 169.5 and values above that. It only colored 168 as green although, 169.5 is the 2nd lowest value. Why does it not mark all 3 green?
Is there a way I can easily fix this ? So that it always marks the 2 lowest values, even if there are multiple of them.
You asked for conditional formatting that:
...always marks the 2 lowest values, even if there are multiple of them.
Try the following formula
=OR(K6=MIN(SORTN($K$6:$K$44,2,2,1,1)),K6=MAX(SORTN($K$6:$K$44,2,2,1,1)))
(Do adjust the formula according to your ranges and locale)
Try rank(), like this:
=rank(K6; unique(K$6:K$44); true) <= 2
I have this list of numbers. I applied a custom number format to it. It's just colon and dot(not decimal point). My goal is to highlight the lowest number there. I'm convinced that my idea of "Is equal to min(A1:A19)" is correct but the result... Any idea why is it highlighting 4 cells and how can I reach my goal some other way?
I first edited player0's answer in order to add some explanation for this issue, but since the edit was rolled back, I'm posting this answer for documentation purposes.
Issue:
The conditional formatting is highlighting the minimum value starting from current row, not from A1. For example, A10 is the minimum value in the range A10:A19, so it gets highlighted.
Solution:
Add the $ operator to the formula:
=MIN(A$1:A19)
Or set Format cells as Custom formula is and set your formula to:
=A1=MIN(A$1:A19)
try:
=MIN(A$1:A19)
or: like this and set it as custom formula:
=A1=MIN(A$1:A19)
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.
I am trying to create a summary row in a google sheet that tallies up how many cells met their criteria. These criterion are set in 2 columns to the left; Column C is the "Goal" column, which has the goal number. Column D is the "MinMax" column, which determines if that goal number is the min or max.
For example, if the Goal is 5 and the MinMax is Max, then the goal is 5 or less (5 being the maximum number allowed).
I already have successfully created conditional formatting for this sheet, which looks like the following:
=IF($D4="Min",E4>=$C4,E4<=$C4) | Turn cell green
I am struggling to find a way to use a similar calculation for the Summary row. I feel like I might need an array formula, but I'm not sure how to set it up.
If you want to count the values try:
=if(D2="Max",countif(E2:E,">="&C2),countif(E2:E,"<="&C2))
If you want to sum them useL
=if(D2="Max",sumif(E2:E,">="&C2),SUMIF(E2:E,"<="&C2))
I actually figured out a formula!!
=countif(ARRAYFORMULA(if($D$4:$D$19="Min",E$4:E$19>=$C$4:$C$19,$C$4:$C$19>=E$4:E$19)),true)-countif(E4:E19,"N/A")
I had to go back into the data and change the blank cells to "N/A" to make it work, but it works!!