I am stuck on a formula for the conditional cell formatting. I want to highlight cells based on "AND" rule of these two conditions:
In cell H3 I have % values. I want to highlight cell where value is below 90%.
AND
In cell B3 I have date formatted as MM/DD/YYYY. I want to highlight cell when the current date is one day before compared date in B3.
I tried:
=AND(H3<90,B3 < TODAY()-1)
What I am doing wrong?
Here is an example.
Works fine and as intended. However this might be the formula you're looking for:
=AND(H3<90,(B3-1) <=TODAY())
Related
I would like to colour cell C3 red, as the value is less than the next filled cell on row 3 (E3).
You need custom formula in the formatting rules for range C2:W.
And you can use the formula below for green:
=and(not(isblank(C2)),C2>index(filter(D2:$W2,arrayformula(not(isblank(D2:$W2))))),1,1)
And make another conditional formatting rule with the same range and change > accordingly for red.
Note that the equal case does not have formatting in your example.
To understand why, there are a few components at work. I'll give an outline in case OP or any passer-by wants one.
First is how conditional formatting in Google Sheet works. I will be brief here. The range we put in the rule is C2:W. Google Sheet will use the beginning cell in that range as a reference. For C2:W, the 1st cell is C2. In the formula, the cells are read in terms of relative position to that reference cell. So when evaluating formatting for cell C2, it treats the formula as is. But, for example, when evaluating formatting for cell C3, Google Sheet iterates all non-fixed ranges by 1 row. Another example: for D3, all non-fixed ranges are iterated by 1 row and 1 column.
Whenever the formula evaluates to true, the format will be applied -- although that is subject to further formatting if you have subsequent formatting rules which apply to the given cell.
Next are the components of the conditional formula.
not(isblank(C2)) checks for blank cells and makes the whole formula only true when the cell is non-blank.
For filter() usage, please consult official documentation. I will explain how filter() is applied to your example.
In our use, we are trying to rid of empty cells in the range that is on the same row as the cell in question and goes from the next column to column W. (I am using column W because there is no known end column in your image. Please adjust to your application accordingly.) Same row as C2 means row 2. Hence the digit 2 in D2:$W2. No $ sign for row because row index is meant to iterate through our range C2:W in the formatting rule. No $ sign for D because we mean 1 column next to the cell in question and the exact column index should iterate. We fix column W because the end column does not evolve and is thus not meant to iterate. Neglecting this will not particularly change the result in your example. However, it is good to be clear with the meanings.
arrayformula(not(isblank(D2:$W2))) produces a local row array whose cells are true/false that each represents whether the corresponding cell is non-blank. filter() in turn only keeps cells from D2:$W2 for cells in arrayformula(not(isblank(D2:$W2))) that are true.
We only care about the 1st non-blank cell. To retrieve the 1st cell from a (local) array, we use index(...,1,1). (That said, omitting index() also happens to work for the 1st cell in particular because when comparing a single cell with > or < to an array range, only the 1st cell of the array is used.)
Apply a conditional formatting to the range desired (starting from cell C2) using this formula:
=IF(C2="",FALSE,OFFSET(C2,0,AGGREGATE(15,6,(COLUMN(D2:W2)-COLUMN(D2)+1)/(D2:W2<>""),1))>C2)
I have a filter() formula in cell A1 which I want to be red if the cell is empty.
The problem is the cell is always populated because of the formula in the cell. Is there anyway round this?
The conditional formatting rule format cells if... is empty will highlight a cell when it is truly blank or only contains whitespace. It does not make a difference whether the cell contains a hand-entered value or a formula.
When a filter() formula gets zero results, the formula cell will display an #N/A error. Error cells are not considered empty. To make the formula cell truly empty in the event of zero results, and let your conditional formatting rule work the way you want, use the iferror(filter()) pattern.
I am trying to conditional format a date range within a sheet. I can conditionally format the cell easily, but can't figure out how to do the entire row. Here is the formula I am using.
=$C:$C=Today()-30
The formula is not incorrect based on what google says, but the cell will go from red back to white.
To apply conditional formatting with a custom formula to a range, write the formula for the cell in the upper left corner of the range. It will be correctly adjusted for other cells, using relative/absolute references in your formula.
In the specific case, the formula should be =C1 = Today()- 30 (if the range you are formatting has C1 as upper left corner).
Please select the columns that comprise "one row" and then Format, Conditional formatting..., Custom formula is:
=$C1=today()-30
select your formatting and Done. (The $ is required if to apply formatting to more than one cell in this way.)
Since "30 days ago or more" is a much more common requirement than just "30 days ago" you might want to consider =$C1<=today()-30.
I'm currently using Google Sheets. I have a spreadsheet that has a horizontal row of dates at the top. I'm attempting to search the horizontal date row for TODAY, and then return the value of a cell vertically below that header. So if TODAY's date is found in "H1" then return the value of "H24", if TODAY's date is found in "Y1" return the value of "Y24" etc and so on.
I've tried =vlookup and =hlookup, but I can't get and semblance of results that aren't an error.
Any help at all would be appreciated, as I'm definitely an Excel/Sheets novice.
Does this formula work as you want:
=FILTER(A24:Z24,A1:Z1=TODAY())
If the current data is in cell H1 then the formula should output the contents of cell H24
I'm trying to set up conditional formatting to change the color of cells in column A if the date is more than 1 day before today's date AND the corresponding cell in column F is blank (ie, A2 and F2). If there is a date in column F, then I do not want the cell in column A to change color. I also want to copy a variation of this formatting into column F (if the date is older than 3 days before today's date AND the corresponding cell in column G is empty), and column G (corresponding with column H). If possible, I'd also like to format column I to change color if the date is today's date, or earlier, but to not change color if there is a date in column H.
All the previous formatting I've attempted has either changed the color of all the blank cells in the column, or will only work for one of the conditions (whichever is at the top of the list), or not at all. Any help would be greatly appreciated!
(I tried to include an image for reference, but it won't allow me)
For the cell, A4, I have created the following formula, which only triggers if the date is older than yesterday and the cell F4 is blank.
=AND(NOT(ISBLANK(A4)),A4<TODAY()-1,ISBLANK(F4))