Using Index Match with a Sum of a Range - google-sheets

Using Google Sheets:
Here is my current formula that I am using to return the data from ONE Date and I am looking to duplicate this formula except SUM the data of a Date Range.
Current Formula:
=IFERROR(INDEX('Delavan Ford'!$AJ$3:$AJ$1000, MATCH ($B$1,'Delavan Ford'!$V$3:$V$1000,0)),"")
B1= the current single date field that it is looking for a match for and returning the data.
I would be adding another field in B2 to be the second date that it is looking for to return the sum of the data between the 2 dates.
Thanks.

SumIF or SumIFs should work. Personally I prefer to use the QUERY() function as I feel it is more intuitive.

You can use SUMIFS() like-
=SUMIFS(A3:A,V3:V,">="&B1,V3:V,"<="&B2)
Or QUERY() function like-
=QUERY(A3:V,"select sum(A)
where V>= date '" & TEXT(B1,"yyyy-mm-dd") &
"' and V<= date '" & TEXT(B2,"yyyy-mm-dd") &
"' label sum(A) ''")

Related

how to concat/merge two columns with different length?

I'm new to google sheet. I have a column(E) with the date and another with a session(F), I want to merge them into one column with each date & different session just like the first few rows in column C.
I've tried "=ArrayFormula(concat(D2:D,concat(" ",F2:F5)))" in column C but only got the first date.
use:
=INDEX(QUERY(FLATTEN(FILTER(E2:E, E2:E<>"")&" "&
TRANSPOSE(FILTER(F2:F, F2:F<>""))), "where not Col1 starts with ' '", ))
see: https://stackoverflow.com/a/68775825/5632629
In your cell C1, try this formula:
=ArrayFormula(E1:E&" "&F1:F)
Well you can simply do concatenate cells like this:
CONCATENATE(E1, " ", F1)
to get what you want I think.
What you're looking for is a cartesian product. I don't have a single formula that does the entire thing for you, but I can suggest a two-step approach.
Get the cartesian product with this formula:
=ARRAYFORMULA(SPLIT(FLATTEN(E2:E9 & "|" & TRANSPOSE(F2:F5)), "|"))
This gives a pair of each date against each time in two result columns. You can then concatenate each row of them in a final result column.

Using a ArrayFormula or Query to replace dragging down SumIf between dates

I would like to change one of the formulas I'm using to return an array of values instead of having to copy/paste or drag down the formula for each cell. My current formula that works for single cells that can be dragged down is:
=SUMIFS('Tracking Tasks'!B$2:B,
'Tracking Tasks'!C$2:C, ">="&B2,
'Tracking Tasks'!C$2:C, "<="&D2,
'Tracking Tasks'!D$2:D, "<>")
The formula sums up all points that are "Completed" between two dates that have also been "Released" (cell not blank). I've tried many solutions, however this appears to be closest to what I'm trying to achieve:
=ArrayFormula(SUM(
QUERY('Tracking Tasks'!B$2:D,
"select B
where C >= date '" & TEXT(B2:B, "yyyy-mm-dd") &
"' and C <= date '" & TEXT(D2:D, "yyyy-mm-dd") & "'")
))
However, this solution doesn't return an array of values like I'd expect it to, and it doesn't account for the "Released" column.
Sample Google Sheet
Solution for you
=ArrayFormula(IFERROR(VLOOKUP(FLOOR((B2:B-2)/7),QUERY({IF('Tracking Tasks'!D$2:D<>"",FLOOR(('Tracking Tasks'!C$2:C-2)/7),""),'Tracking Tasks'!B$2:B},"select Col1,sum(Col2) where Col1>0 group by Col1"),2,0),""))

How to select a specific cell in Google Sheets' QUERY?

So I have named range called Profil. It is on another sheet. The "C" cell on that query is in Profil range. I want to set C parameter to start date (B3) end date (B4) cell, so the date is dynamically changed according to the start date and end date. Is there any possible way to do it?
I believe this should work:
=QUERY(Profil, "SELECT * WHERE C>=DATE'"&TEXT(B3,"yyyy-mm-dd")&"' AND C<=DATE'"&TEXT(B4,"yyyy-mm-dd")&"'",1)
The query needs the date in a specific format (yyyy-mm-dd), this converts whatever is in cell B3 and B4 into that format and checks the less than / greater than formula.
Works for me:
try like this (with EU locale):
=QUERY(Profil; "where C >= date '"&TEXT(B3; "yyyy-MM-dd")&"'
and C <= date '"&TEXT(B4; "yyyy-MM-dd")&"'"; 1)

Conditional formatting with QUERY result in Google Spreadsheet

I have a spreadsheet with 1 sheet of software version an another sheet of installation records. I want to do a conditional formatting that compares the version of in installation (on column F) to its know latest version number on another sheet ('Software Versions').
Current Solution
I came up with this formular initially:
=AND(F2<>"", F2=G2)
It works. But I need to maintain a column of QUERY results on G2:
=QUERY('Software Versions'!$A$1:$B$8, "Select B where A='" &D4& "' LIMIT 1")
Problem
Now I want to remove the G2 row altogether. I came up with this combined query:
=AND(F2<>"", F2=QUERY('Software Versions'!$A$1:$B$8, "Select B where A='" &D4& "' LIMIT 1"))
But I cannot save it because it is an "Invalid Formula":
Any way to actually do it?
Try use this formula:
=AND(F2<>"", F2=IFERROR(QUERY(INDIRECT("'Software Versions'!$A$1:$B$8"),
"Select B where A='" &D4& "' LIMIT 1 label B ''"),""))
I was able to make conditional formatting with this formula.
Improvements
Use indirect to address another sheet
Use label B '' to prevent header appear as query result
Use iferror(..., "") to be sure no error occurs when no data is found with query
I'm used to the good old VLOOKUP function for my conditional formattings.
The syntax is VLOOKUP(valueOrCell, sourceRange, index, FALSE)
So if the value from first parameter valueOrCell, exists in the sourceRange, return the value at index. FALSE is to have the exact match.
In my example I'm using only a single worksheet, but if you set the sourceRange to different worksheet it works as well.

Sum of a required value within two separate date range using Query function in Google sheet

I am in need of a sum of a completed values present in between two separate dates using Query function. My sheets are as follows. The first sheet name is "Sheet1" & The 2nd sheet name is "Sheet2". I need the count(SUM) of India completed values in the cell Sheet2!A2 within the date range of Cell A1 & Cell A2. For this, I was trying with the below Query function. But it didn't work out. Can anyone please help me here to get this data.
You need to use the below formula there
=sum(query(Sheet1!$A$1:$D$13,"Select 1 where D='India' and A>=date '" & TEXT(A1,"yyyy-mm-dd") & "' and A<= date '" & TEXT(B1,"yyyy-mm-dd") &"'",1),0)

Resources