Google Sheets multiple conditional formatting for date range and text - google-sheets

I'm trying to apply multiple conditional formatting to a google sheets column. I want two conditions:
A Column needs to equal/contain "Accepted" from a dropdown cell
B Column needs to contain a future due date that is within 14 days to today
I want to highlight C column based on those two conditions being met with a priority flag for Accepted and has a due date within 14 days of today. Here's what I've got so far:
Custom conditional formatting for column C is:
=(A="Assigned")+(B<=TODAY()+14)
What I'd like to see is:
=(A="Assigned")+(B<=TODAY()+14)+(B>=TODAY())
But it's not working. Either I have to specify the exact reference columns (ex: A5) which aren't what I want, or it's not working at all. Any recommendations?

Yes - just get it right for the first row (say row 2) and the other rows will follow by relative addressing:
=and(A2="Accepted",B2>=today(),B2<=today()+14)
If you want to apply the conditional formatting to more than one column, put in dollar signs to anchor the columns:
and($A2="Accepted",$B2>=today(),$B2<=today()+14)

you were close... this is what would work as well:
=($A2="Assigned")*($B2<=TODAY()+14)*($B2>=TODAY())

Related

How do I conditionally format a date that falls between two dates from a list of start and end dates?

I have created a dynamic calendar in a Google Sheets document and with it a list of dates:
The days are dynamically populated with the full date but formatted to only show the day (for example, the full value of August 22nd is 8/22/2020 but it is formatted to only show 22). I would like to use conditional formatting to highlight the date ranges listed on the right. For instance, I would simply like the dates 8/12, 8/13, and 8/14 (in addition to the other date ranges in those columns) to be highlighted using conditional formatting.
I've been able to get single ranges highlighted by directly targeting the I and J cells in the range A3:G8 like so:
=AND(A3>=$I$2,A3<=$J$2) or by switching up the column value. Removing any $ symbol breaks the conditional formatting.
I know this is not correct to get each range in the list to appear, but this is the only way I could get any ranges to work. Obviously I don't want to go one by one, but nothing else I've tried has worked. I've spent the last 5 hours scouring the internet and have come up with nothing like this problem. I have tried too many things to list here, and nothing has worked.
FWIW, this is my test data set. My full data set is much larger, is not sorted by start date, and has some start dates missing. I could potentially clean up the missing start dates if necessary, but my final dataset can't be sorted.
Ideally, the final product should look something like this:
Try
=SUMPRODUCT((A1<=$J$2:$J)*(A1>=$I$2:$I)*(A1<>""))>0
You can add as many rows as you wish.
Explanation
In this formula, you have 3 conditions
=SUMPRODUCT(condition1 * condition2 * condition3)
If one condition is false, you will get 0 (for instance truefalsetrue = 0 )
If all three conditions are true, you will get something > 0, that means that the date is not null and between a range of dates

Conditional formatting if date between multiple ranges [duplicate]

This question already has an answer here:
I get Formula parse error with all formulas
(1 answer)
Closed 4 months ago.
I've got a calendar view and a list of dates with some values. I would like to conditionally show a different color for a given date if that date is in range and the status of it is N. So for statuses 0, 1, and 2 I would like to have different colors in the calendar.
I've tried with =IF(SUMPRODUCT((A9<=C2:C5)*(A9>=B2:B5)),"Y","N") but it seems that it does not work with dates.
So it looks like this, and I would like to make the calendar to have colors as in column C.
Here is the link to the sheet.
You can use conditional formatting.
You shoould put 2 conditions connected with AND for each period
My spreadsheet is now set to polish so please forgive me.
Mark your calendar view and Use conditional formatting.
Use custom formula and write:
=and($a$2<=f2,$b$2>=f2)
Next rule will be:
=and($a$3<=f2, $b$3>=f2)
and so on
for the first period
Your formula should work. You just need to correct the usage/format of it.
Instead of using comma(,) as delimiter of parameters in IF. Use semicolon(;).
This formula works fine on my end.
=IF(SUMPRODUCT((A9<=$C$2:$C$5)*(A9>=$B$2:$B$5));"Y";"N")

When using SUMIF function, is there a way to accept timestamp values (e.g. 2/12/2019 19:56:16) as the range to test against the criteria?

I'm working with two columns,
column A: a list of timestamps
column B: a list of numbers
I'm trying to use the sumif(range, criteria, [sum range]) function to check if the month in column A is January, and so on for all months.
The issue is that I need a way to either convert the range for the sumif to month names, or use criteria other than a string (because a timestamp isn't going to ever be "=January".
My thought was that I could do either
=sumif(TEXT(TO_DATE(A2:A),"mmmm"), "=January", B2:B)
or
=sumif(A2:A, TEXT(TO_DATE(A2:A),"mmmm")="January", B2:B)
these are more or less pseudo-code, I'm trying to convey my thought process
I understand I could create a new column that converts the timestamps into months, but is there anyway I can preform this sumif, without having to make a new column?
Using SUMIFS, with dates you set the extents, this works in excel and google sheets:
=SUMIFS(B:B,A:A,">=" & DATE(2019,1,1),A:A,"<" & DATE(2019,2,1))
With Google Sheets you can also use filter:
=SUM(FILTER(B:B,MONTH(A:A)=1))
"=2" = February, "=3" = March, etc.
=ARRAYFORMULA(SUMIF(MONTH(A2:A), "=2", B2:B))
if you want to select it from a drop-down menu use:
=ARRAYFORMULA(SUMIF(MONTH(A2:A), "="&MONTH(F2&1), B2:B))

How can I highlight cells in Google Sheets if current month?

How can I highlight cells in Google Sheets if current month?
The cells have Jan-2017, Feb-2017 etc. and not dates.
I just want the current month highlighted so that the rest of the team can keep track of our monthly stats.
I'm supposing the column that has the months is A, and that the actual values of each cell is the first day of each month (so 2/1/2017 for February for example).
Select where you want the conditional formating to go, and open the conditional formatting sidebar.
Choose "Custom Formula" from the dropdown, and paste the following in:
=$A:$A=(today()-day(today())+1)
What we are doing here is:
=A$:A$ - Look in column A for the following
today() get todays date
-day(today()) get the day and subtract it from the today in the previous point
+1 add 1 to the result because 2/8/2017 - 8 = 2/0/2017, which google sheets actually recognizes as 1/31/2017, so by adding 1 it will become 2/1/2017 which is what is wanted.
The result of this sum is then compared to the data found in A$:A$ and the results which match the sum (today()-day(today())+1) are highlighted.
Just for the record, this may work as well using conditional formatting's custom formula:
=month($A:$A)=month(today())
Considering the dates are in the column A

Using arrayformula to autofill formulas for new entries- comparing cells in the same column

Relative beginner to using formulas in excel/google sheets, and I'm having some trouble figuring out how I can use an array formula to compare cells in different rows but the same column in google sheets (in my case, how I can do =IF(A3=A2,dothis,elsedothis) as an array formula. I'd also be interested if anyone has a different solution other than array formula to autofill formulas in.
The specifics:
I have a list of participants who've done an experiment, and some of them have done it multiple times. With a long list of participants and multiple entries for some participants, it's difficult to see where one participant's info ends and the next begins. So what I want is to alternate the rows in gray and white shading based off of the participant's number (ie. all of 001's entries in gray, all of 002's entries in white, 003's in gray, and so on). To do this, I put in a column on the right using a formula that checks if the participant number in the row above it is the same and, if not, it adds one (I'd like to use this to get a participant count later on). This is what the dataset looks like, and I've included the formula on the right.
A B ... ... X
001 9/1/16 ... ... 1 (1)
001 10/1/16 ... ... 1 (=IF(A3=A2,X2,X2+1))
001 11/1/16 ... ... 1 (=IF(A4=A3,X3,X3+1))
002 9/2/16 ... ... 2 (=IF(A5=A4,X4,X4+1))
002 10/2/16 ... ... 2 (=IF(A6=A5,X5,X5+1))
003 10/5/16 ... ... 3 (=IF(A7=A6,X6,X6+1))
...
All this is working fine and dandy, but the problem is, when I enter a new row, it doesn't automatically fill in the formula, and so the shading doesn't adjust. I suppose I could redrag down the formula every time I enter in new participant info, but that's tedious and I'm not the only one using it, so it's going to get messed up pretty quickly. From what I looked up, arrayformula is what I should be using. But you have to refer to the column as a whole if you use arrayformula. Anyone have any ideas?
Assuming you got the conditional formatting covered, I believe the formula(s) you use can be turned into one single array formula so that the output auto-expands when new rows are added. Example:
={1; ArrayFormula(IF(LEN(A3:A), offset(A2,0,0,ROWS(A3:A),1) + IF(A3:A = offset(A2,0,0,ROWS(A3:A),1), 0, 1),))}
See if that would work for you?
NOTE: the custom formula in conditional formatting used in the spreadsheet is
=AND($X1<>"", ISODD($X1))
One way to achieve the desired result:
To alternate the rows in gray and white shading based on the participant's number do the following:
Under the Format Menu choose conditional formatting
Enteries for the Conditional format rules dialog
In apply to range select the range e.g. A2:A16 (it may include blank cells)
For Format cell if choose Custom formula is
Type =isodd(A2:A16) in the text box below
For Formatting style choose Custom
Choose gray color from the fill button
Finally hit Done
To get a participant count you can use the formula =countunique(A2:A16)
You can do this alltogether without an additional helper column at all, just using conditional formatting:
The custom function to add into the conditional formatting option is this:
=isodd($A:$A)=TRUE
At the end if you still want your participant count, you can use this:
=COUNTA(UNIQUE(A:A))

Resources