I have a range of cells that must be one of the below values:
01
02
04
05
06
07
08
99
and cannot be blank.
I have a traffic light cell at the top above the heading (in cell R2), and I am trying to write a traffic light formula in cell R2 so that the cell is Red if any of the range R4:R223 doesn't match one of the above. If they all match then it must be green.
I have this formula in the traffic light cell (R2) at the moment and it works if R4 doesn't contain one of the values:
=IF(AND(R4<>"01",R4<>"02",R4<>"04",R4<>"05",R4<>"06",
R4<>"07",R4<>"08",R4<>"99"),CHAR(251),CHAR(252))
(Char(251) is a wingdings cross, and char(252) is a wingdings check or tick)
so what's supposed to happen is if I change the values in R4:R223 to not match that list, then there should be a cross in the cell, and this in turn will kick off the Red conditional formatting rule.
And I have this formula in the conditional formatting of the entire range (and it works):
=AND(R4<>"01",R4<>"02",R4<>"04",R4<>"05",R4<>"06",R4<>"07",R4<>"08",R4<>"99")
So how do I use this formula in the IF statement to return Char(251) when one of the cells in the range doesn't match the list or is blank?
You should look into SUMPRODUCT. It is very powerful and helpful in these situations. So first I would use this formula in the Traffic Light Cell.
=IF(SUMPRODUCT(($R2:$R11="01")+($R2:$R11="02")+($R2:$R11="03")+($R2:$R11="04")+($R2:$R11="05")+($R2:$R11="06")+($R2:$R11="07")+($R2:$R11="08")+($R2:$R11="99"))>221, CHAR(252), CHAR(251))
This will check all cells in R against your values. If all of them match, then SUMPRODUCT will return 222 (your max number of cells). If the number is above 221 then the IF statement will return TRUE and will then return the check.
I would then remove the IF portion of the statement and add =TRUE at the end for the conditional formatting portion.
=SUMPRODUCT(...)>221=TRUE
Related
I want to apply conditional formatting (colour a corresponding cell or use symbols [green/orange/red] circles) to a cell
My conditions are the following:
If e.g. cell A4 is empty then
check if date of current cell lies no less than 13 days in the past - if that condition is met -> Format cell Green (or add Green circle in the cell)
check if date of current cell lies no less than 14 and no more than 27 days in the past - if that condition is met -> yellow (yellow circle)
check if date of current cell lies more than 27 days in the past - if that condition is met -> red circle.
If cell A4 is not empty, then do not apply any formatting.
I am kinda stumped with the conditional formatting and I don't know how to combine if-statements in the formula for my specific use case.
Any and all help will be greatly appreciated!
Thanks!
For formatting, you can configure it this way:
The formulas are respectively:
=AND(ISBLANK($A$4), ISNUMBER(D1), TODAY() - D1 <= 13)
=AND(ISBLANK($A$4), ISNUMBER(D1), TODAY() - D1 <= 27)
=AND(ISBLANK($A$4), ISNUMBER(D1), TODAY() - D1 > 27)
Explanation:
Note that D1 is the top left of the range where the conditional formatting applies. It is important for it to match the formulas.
As the formulas for yellow is always true when the formula for green is true, it is important you tick Stop if True like I did (or reverse the order of the formulas).
The formatting applies whenever the formula returns true. The conditions are:
$A$4 (note the $ to fix the cell address) is empty (ISBLANK)
The current cell (D1, corresponding to the top left of the range) is a number (dates are internally numbers in Excel).This condition among other things, prevents the cell from being formatted when it is empty.
The conditions you have given for the date apply. Note that the very last TODAY() - D1 > 27 is unnecessary (if your cell contains a date and is not already colored by green or yellow, then it is bound to be red) but I kept it for consistency.
Finally, you may want to add a condition to ensure the date is in the past (should a date in the future be colored green or yellow?).You have not mentioned anything about future dates so I did not but all you have to do is add D1 < TODAY() or D1 <= TODAY() in each formula to make that work.
You can try this:
=IF(ISBLANK(A4),"",IF(TODAY()-current_cell_date>=13,"Green",IF(AND(TODAY()-current_cell_date>=14,TODAY()-current_cell_date<=27),"Yellow","Red")))
and for symbols you can try this:
=IF(ISBLANK(A4),"",IF(TODAY()-current_cell_date>=13,"āļø",IF(AND(TODAY()-current_cell_date>=14,TODAY()-current_cell_date<=27),"š¢", "ā")))
But make sure you use a font which can interpret unicode.
In order to apply conditional formatting, I advise you to come up with a formula, which gives TRUE for the cases you want to format and FALSE otherwise.
For your one situation, I have created this formula (where I suppose the date will be filled in in cells in "C" column):
=AND(ISBLANK($A$4),NOW()-C4>13)
(You can type this formula in another column (like column "D") and put some date values in "C" column. Then drag and drop that formula down.
One of the crucial points is that $A$4 won't change because of the dollarsign, which indicate an absolute cell reference. Filling in something in that cell or not changes the whole behaviour.
In my screenshot, you have the formula result and the conditional formatting, based on that particular formula:
I am trying to setup conditional formatting so that the formatting takes effect if the previous 4 cells in a column are blank. I need the range inside the conditional formatting formula to move as it is applied to cells below it, for example:
If I am tracking sales by store, if there is a 4 week period where a certain store doesn't record any sales I want those 4 weeks to automatically highlight.
My current formula is to select cells B5:B11, enter the formula =SUM(B2:B5)=0 to trigger the cell highlighting.
My problem is that when I look at cell B6 the range it looks for to be blank is still B2:B5 and I need it to be B3:B6.
Is there a way to set this up so that the range will change as it moves down a column?
This one has gotten me thinking a bit, and here is my solution for it.
My solution needs to use four conditional formattings, i.e. set up four conditional formattings in each cell, and then use format painter to apply the conditional format to all the cells.
Suppose your week table is in range A1:D20, and suppose you want to highlight cells if there are at least (not only) four consecutive blank cells.
Highlight cell B2, and then set up conditional formatting using the following four formulas:
=SUM(OFFSET($B2,0,0,4,1))=0
=SUM(OFFSET($B2,-1,0,4,1))=0
=SUM(OFFSET($B2,-2,0,4,1))=0
=SUM(OFFSET($B2,-3,0,4,1))=0
Then should have something similar to the following when examing the conditional formatting window:
Lastly, highlight cell B2, use the Format Painter function under Home tab and then apply the format to the rest of the cells in the week table. Then you should have something similar to the following:
It is easy to find the first blank cell of four consecutive blank cells, but it is difficult to identify the second, third and fourth blank cells using one formula. The workaround uses four different formulas to identify each of the four blank cells (I hope this makes sense). Please note the following is only looking at Column B of my example, not all columns:
Not pretty, but it works. This will highlight all occasions where the store has at least 4 weeks of consecutive donuts.
Columns B:D = Original Data
Columns E:G = Helper Set 1
Columns H:J = Helper Set 2
There's probably a way to get just one helper set, but this works and was easy to validate. First I added 3 empty rows above week 1.
In cells E4, E5 and E6 place a 0. You don't have to, you could also leave these blank.
Cell E5 formula, which is counting the number of consecutive blanks:
=IF(ISBLANK(B5),E4+1,0)
Drag it over to column G and drag it down.
Cell H5 formula, which is looking at 4 weeks later to see if there were consecutive blanks found in helper set 1:
=IF(E8>=4,"Yes","No")
Drag it over to column J and drag it down. Also, in the row above it, repeat week 1 values.
Lastly, select your original data range (B5:D14) and create this conditional formatting formula:
=(OR(H5="Yes",H4="Yes",H3="Yes",H2="Yes"))
Once you're satisfied, you can hide rows 2:4 and can also hide your helper columns.
Apply the following condition to each respective ranges:
Range: B2:D2:
=SUM(B2:B5)=0
Range: B3:D3:
=OR(SUM(B2:B5)=0, SUM(B3:B6)=0)
Range: B4:D4:
=OR(SUM(B2:B5)=0, SUM(B3:B6)=0, SUM(B4:B7)=0)
Range: B4:D8:
=OR(SUM(B2:B5)=0, SUM(B3:B6)=0, SUM(B4:B7)=0, SUM(B5:B8)=0)
Result with sample data:
I'am trying to create a conditional formatting which formats only cell below, but only if cell above and cell below both has number in them (negative or positive).
Now i got this:
=ISNUMBER(OFFSET(INDIRECT(ADDRESS(ROW(); COLUMN()));-1;0))
This formats the cell below if the cell above has a anything. It does not respect the condition where the cell below also must have a number.
Could somebody help me out here? I am realy stuck :)
EDIT:
So now i tried this:
=AND(ISNUMBER(INDIRECT(ADDRESS(ROW();COLUMN()))); ISNUMBER(OFFSET(INDIRECT(ADDRESS(ROW();COLUMN()));-1;0)))
But no luck whith this one either.
Just to clarify. This formula should run on $A$3:$BB$100
So for example if:
A5 = 10 (or any positive or negative number)
A6 = 10 (or any positive or negative number)
A6 should be formatet.
But if:
A5 = 10 (or any positive or negative number)
A6 = EMPTY
No formating should happen.
Hope this clarify what i'am trying to do :)
=AND(ISNUMBER(A5),ISNUMBER(A6)) This formula will also bypass formatting for A6 as well if both cells are empty. I assume that's what you want, as there's no value within either to format.
I see why we are getting different results with the formula. Conditional formatting is applied relative to the active cell when applied. Start with cell A2 as the first cell highlighted, (A2:A100),and then use this formula =AND(ISNUMBER(A2),ISNUMBER(A1)).Cell A2 should be the first active cell within the range of applied formatted cells.
I want to give a quick indication using coloured cells of the time likely to be taken to complete a task. So for example:
if cell B2 = 1 then fill cell range G2:H2 with light red
if cell B2 = 2 then fill cell range G2:J2 with light red
if cell B2 = 3 then fill cell range G2:L2 with light red
How might I achieve this?
Select G2:H2 and use a CF formula rule of:
=$B$2=1
Select G2:J2 and use a CF formula rule of:
=$B$2=2
Select G2:L2 and use a CF formula rule of:
=$B$2=3
each with the formatting of your choice.
If you want a dynamic formula and only one format setting you can select all the cells you want to format, then make a new conditional formatting rule using the formula:
=$B$2*2+COLUMN($G:$G)-COLUMN()>0
Which will affect 2 additional cells each time you increment $B$2.
I used your examples of $B$2 and starting with $G:$G but you can change those if needed.
If you need multiple format settings this won't work.
Iām wondering if someone can assist with a conditional formatting issue i just can't wrap my head around
We currently have a table with names in and next to the name a number
Bob 5
Michael 6
Now if i type bob in cell A1 i would like it to highlight that row and the four below it.
another example would be if i type Michael in cell A1 it would highlight that row and 5 below that
any help is appreciated
I couldn't write a simpler formula, but that one worked with the data I tested.
A1 will be where names will be inserted.
The table will range from C1 to D7 (assuming there are no column labels).
Select the table C1 to D7 and insert conditional formatting with formula and use the formula:
=AND(COUNTIF(OFFSET(C1,IF(ROW()-VLOOKUP($A$1,$C$1:$D$7,2,0)<=0,1-ROW(),1-VLOOKUP($A$1,$C$1:$D$7,2,0)),0,VLOOKUP($A$1,$C$1:$D$7,2,0)),$A$1)>0,ROW()>=MATCH($A$1,C:C,0))
And pick the formatting your want.
The formula checks two conditions:
COUNTIF(OFFSET(C1,IF(ROW()-VLOOKUP($A$1,$C$1:$D$7,2,0)<=0,1-ROW(),1-VLOOKUP($A$1,$C$1:$D$7,2,0)),0,VLOOKUP($A$1,$C$1:$D$7,2,0)),$A$1)>0
This checks if there is at least 1 match within a designated range depending of the value in D. It will check if there is a match x rows above the current row where x is the value. If there is, the we get the first boolean value (true or false).
The second ROW()>=MATCH($A$1,C:C,0) ensures that the match is above or on the current row.
Google Spreadsheet Demo