regexmatch doesn't seem to work with minifs in Google Sheets - 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.

Related

Google Sheets – Query for a date returns no values

​​I'm trying to filter a list from another sheet by the dates of the entries and simply doesn't work:
=QUERY(Import!A:Z;"select A,T where T >= date '2021-08-27'";0)
​When I remove the date part it works fine, as expexted for filtering by text. I need the ability to sort by exact dates though, because I would like to add some more complex filters. When I set the last part of the function to a 0 instead of a 1 it shows only the first entry.
The source column is set to the correct date format. The data is pulled from another document using the IMPORTRANGE()​ function (I don't seee how this should make any difference though).
I feel like I'm misssing something simple here and would be glad if someone can point me in the right direction!
Check your date column if all cells are formatted as date. I had missing values as "='---" and the query filtering by date returned nothing. Changing the missing values to "=NA()" did the job.
Try this:
=QUERY(Import!A:Z;"select A,T where T >= date '"&TEXT("2021-08-27";"yyyy-mm-dd")&"'")

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

How to find earlier date in google spreadsheets?

in Google Spreadsheets I have a column A with dates and column B with specific values corresponding these dates:
A
B
10-Jan
51.1
11-Jan
49.2
14-Jan
50.3
If I find via VLOOKUP function the value of 11-Jan, it will work and show 49.2.
Off cause it won't work if I try to find a value of 13-Jan since it is absent from the list of dates. However, if the date is absent in column A I want to get the value of earlier date which is in the list (i.e. I want to get 49.2 corresponding to 11-Jan, if I use 13-Jan as the query for finding the value).
Maybe this type of search can be realized by using INDIRECT function, but I can't figure out the formula.
How do realize this?
Your problem can be solved by using vlookup only but with different parameter, if you indicate True for the last parameter, it mean the formula will try to return the closer match if it cannot found any result.
=arrayformula(VLOOKUP(E1:E5,A:B,2,True))

SUMIFS and/or QUERY inside ARRAYFORMULA

Google spreadsheet sample: https://docs.google.com/spreadsheets/d/1MdRjm5QmKY_vaah9c3GrvH6dDOBCQX_zvCubvN0akmk/edit?usp=sharing
Im trying to get the sum of all values for each ID. The values im trying to add up are found in the Source tab while the calculations are done in the Output. My desired values are based on 2 things: ID and Date. The Id is supposed to match and the Date is supposed to be February. I tried first just using a sumif with just matching ID and it worked using this formula: =ARRAYFORMULA(IF(A2:A="",, SUMIF(Source!A:A,A2:A,Source!B:B)))
But when I add the 2nd critera and use a sumifs function, it only outputs for the first id. Here is the sumifs formula I used: =ARRAYFORMULA(SUMIFS(Source!B2:B,Source!A2:A,A2:A,Source!C2:C,">="&DATE(2021,2,1),Source!C2:C,"<="&DATE(2021,2,28)))
I tried using query as some of the answers I found online suggested to use it but it also outputs the first data only, here is the query formula I used =ARRAYFORMULA(QUERY(Source!A2:C,"select sum(B) where A = '"&Output!A2:A&"' and C >= date '"&TEXT(DATEVALUE("2/1/2021"),"yyyy-mm-dd")&"' and C <= date '"&TEXT(DATEVALUE("2/28/2021"),"yyyy-mm-dd")&"' label sum(B) '' "))
I know this is possible by making a temporary query/filter where you only include desired dates and from there I can use SUMIF, but I will be needing to make a monthly total and making 12 of these calculated temporary filters/query would take up a lot of space since we have a lot of data so I want to avoid this option if possible. Is there a better fix to this situation?
Solved by Astrotia - =arrayformula(sumif(I3:I20&month(K3:K20), A2:A6&2, J3:J20))

ArrayFormula + simple if statement on Google Forms

I am building a worksheet that takes form-submitted data and runs a few calculations. I am having trouble autopopulating cells with simple if statements. I am wondering about how to use ArrayFormula with a statement like:
=IF(J2<I2+1,1,0)
Or, even more complicated, an IF statement and a VLOOKUP:
=IF(H2+K2=2,VLOOKUP(F2,'Event Info'!A2:D7,4,False),"Message")
Thanks!
These formulae may work as you want. The LEN(A2:A) section checks your column A and will only output if there is a timestamp value from the Form :
=ArrayFormula(IF(LEN(A2:A),IF(J2:J<I2:I+1,1,0),))
=ArrayFormula(IF(LEN(A2:A),IF(H2:H+K2:K=2,VLOOKUP(F2:F,'Event Info'!A2:D7,4,0),"Message"),))

Resources