Conditional formatting if date between multiple ranges [duplicate] - google-sheets

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")

Related

regexmatch doesn't seem to work with minifs in Google Sheets

I'm trying to find the min date for sub-tasks that are related to the same Task ID.
Because I want to leave the task min date cell blank if none of the sub-tasks have a date entered, I use the following formula:
=if(SUMPRODUCT(regexmatch($A18:$A,"^Sub-Task "&$B16&".[0-9]"),$F18:$F=$F16,G18:G<>"")<>0,minifs(G18:G,$A18:$A,regexmatch($A18:$A,"^Sub-Task "&$B16&".[0-9]"),$F18:$F,$F16,G18:G,"<>"),"")
This breaks downs as follows:
In the SUMPRODUCT function
I use regexmatch($A18:$A,"^Sub-Task "&$B16&".[0-9]*") to check that I only look at sub-tasks that have the same ID as the specific task "B16"
I use $F18:$F=$F16 to check that I only look for "Planned" dates, which is in "F16" instead of "Actual" dates
I use G18:G<>"" to check that I only look for date cells that aren't empty
If the sumproduct results in something, I then use the minifs() function to find the min value of the result.
IF the sumproduct results in nothing, I enter blank "" in the cell
The sumproduct seems to work perfectly well and gives me the results that I expect when I change values around, but the minifs function doesn't seem to work with regexmatch()
Is there a different syntax that has to be used in minifs functions?
try:
REGEXMATCH(A18:A&"", "^Sub-Task "&B16&".*")
inserting numeric value in regex will cause VALUE error
Figured it out, minifs can take regex directly, but only simple ones; it doesn't like characters like "^", and I was able to work around it for my needs.

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

Google sheets Combining Query with Today() [duplicate]

This question already has an answer here:
How to compare dates or date against today with query on google sheets?
(1 answer)
Closed 5 months ago.
I would like to use the today function in a query. Right now I have to manually change the date each morning, which is time consuming. The query is:
=QUERY(StageTracking!A:W, "SELECT C where A =date'2021-05-13'")
When I try
=QUERY(StageTracking!A:W, "SELECT C where A =today()")
I get a #VALUE error.
I know it's just a syntax thing I'm not catching but I have tried many variations on the line above.
Let me offer another (perhaps simpler) option, given what I can tell from your post info.
Add a header in the top cell of your results column and put the following formula into the second cell of that otherwise empty column:
=FILTER(StageTracking!C2:C,StageTracking!A2:A=TODAY())
ADDENDUM (after seeing the actual sheet):
This is an excellent case in point of why it is always most efficient and effective to share a link to a sheet, since your formula attempts as originally posted (and mine as posted above) would not work with your actual layout and goal.
I've added a new sheet ("Erik Help").
First, I un-merged Rows 2-8 and simply increased the height of Row 2. There was no reason to merge those rows; and merging nearly always causes issues, especially in ranges where formulas or reference ranges are involved.
Next, I deleted your original A2 formula (=QUERY(StageTracking!A1:W1000,"select C where A = '06/23/2021'",1)) and replaced it with the simple =StageTracking!C1, which accomplishes the same thing. Again, I'm not sure what led to the long formula, but it was unnecessary.
I then deleted all of your individual erroneous formulas from B2:K2 and replaced them with one formula in B2:
=FILTER(FILTER(StageTracking!E2:W,StageTracking!A2:A=TODAY()),ISODD(COLUMN(StageTracking!E1:W1)))
This formula first creates a FILTERed array of everything from E2:W where A2:A = TODAY(). Then a second FILTER is applied to bring in only the odd columns.
NOTE: currently, while the formula is working, you will see no results in E2:W because you don't have any data for TODAY in your StageTracking sheet yet. Once you add data for today's date, you will see the formula populate B2:K2. (Or, you can simply add -1 after TODAY() in the current formula if you want to see the results from "yesterday" temporarily, in order to be sure the formula is, in fact, working.)
Try this:
=QUERY(StageTracking!A1:W1000,"select C where A = '06/23/2021'",1)
or
=QUERY(StageTracking!A1:W1000,"select C where A = date '"&TEXT(TODAY(),"yyyy-mm-dd")&"'",1)
Take a few minutes to review the scalar functions supported in the QUERY() function.
https://developers.google.com/chart/interactive/docs/querylanguage#scalar_functions
You can use YEAR(), MONTH(), DAY() or NOW(). NOW() is a compete datestamp including time, so that would require more effort.

Google Sheets multiple conditional formatting for date range and text

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())

Highlight out of date cells

currently I have a spread sheet of dates. A1 is todays date 3 years ago.
A3:A20 are various dates when employees gained their first aid certificate.
When any cell in A3:A20 is less than A1 it would mean their certificate is out of date. I would like it to be highlighted.
Does anyone have any ideas? mine have all failed :)
Something like this should work in new google sheets.
In cell A1 put in todays date by using
=Now()
Go to Format, conditional formatting
Select custom formula is
Enter
=datedif(A$3:A$20,$A$1,"Y")>3
Select your colour, such as red, then finally in the range. put A3:A20

Resources