Asking how to make combined query with name and date - google-sheets

this is my first post here.
I'm new to google sheet and this is the first time I'm using query.
I already watched some tutorials on youtube, but i'm having a hard time how to combine query between name and dates (start and end date). I only managed to make how to search name query
Can someone help me how to make this combined query? Thank you so much
The file: https://docs.google.com/spreadsheets/d/1AzldUqBoXz_tDZB8EppB7Kh2l32UtMmrXXonOxcCYDA/edit?usp=sharing

Try below QUERY() function. See your sheet.
=QUERY(Database!A:H;"select * where D='" &B4 & "' and E>= date '" &TEXT(E4;"yyyy-mm-dd")& "' and E<= date '" & TEXT(G4;"yyyy-mm-dd")& "'")

Related

Using Index Match with a Sum of a Range

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

Google Sheets - How to Extract dates list in new column from start date and end date

i need to extract dates (for each day) between 2 dates (start & end) in new column in google sheet.
The data is:
The result should be like this:
i now that it can be done with EXCEL + POWER QUERY
with google sheets i did not find anything
i will be glad if someone will help with that.
Thanks.
Depending on your locale settings, try:
=arrayformula({A1:C1,"DAY";split(query(flatten(array_constrain(if(split(rept(10,C2:C-B2:B+1),0)=1,A2:A&char(9999)&B2:B&char(9999)&C2:C&char(9999)&B2:B+transpose(row(A:A))-1&char(9999),),counta(B2:B),max(C2:C-B2:B)+1)),"where Col1 is not null",0),char(9999))})

Google Sheets Query: Bring data by date in cell

I am trying to query a google sheet by date. I have done some research and learned I need to convert to TEXT format so that I can run the comparison, but I am not able to get the syntax correctly:
=query('SheetName'!$A2:$S, "select A Where O=date'"&TEXT(B2,"yyyy-mm-dd")&)
Could you give me some guidance?
Some more info: in my query, B2 is a valid date in date format. Column O has some cells that are text strings and others that are valid dates; I have set the format of the entire column to "Date".
Here is a link to a simple example, feel free to play around with the query: https://docs.google.com/spreadsheets/d/1O4ms9ufvZ_CRLl_LG45hksjRoOJtv0XexbfjCLqFW4I/edit?usp=sharing
See if this works?
=filter('SheetName'!A3:A, 'SheetName'!O3:O=B2)
correct syntax should be:
=ARRAYFORMULA(QUERY(TO_TEXT(SheetName!$A2:$S),
"select Col16 where Col15 = '"&TO_TEXT(DATEVALUE(B2))&"'"))

Comparing dates in Google Sheets QUERY() formula

Looking for some assistance please.
To start, here's the function that I'm having trouble with:
=IFERROR(
QUERY(
OrderDetails!A8:Q9,
"SELECT SUM(J) where Q >= date '" & TEXT(D3,"yyyy-mm-dd") & "' label sum(J) ''"
),
0
)
The dates in the data range (OrderDetails!A8:Q9, columns P is Date & Q is DateOnly) look like this:
I added Q manually in an attempt to make the date-matching work, but P is the raw data which I would prefer to use.
Next the SUM(J) which are just order balances. If I remove the WHERE clause the query runs as expected.
D3 is the column date I want to match to, in the format: 8/13/2018, however I've formatted it on screen to be only DDD.
To show the actual value rather than the header in the cell, I've used label sum(J) ' '.
When running I get the message "Nothing to return".
Can anybody spot an obvious error with the code or my approach? Happy to add any further detail if needed.
Populate Q8 with:
=left(P8,10)*1
and copy down.
The QUERY is failing for attempting to compare a date (in D2/3) with the output of a string function (LEFT). *1 coerces the strings into dates. Left alignment was a clue that the contents were Text.

Google Sheet Advanced Search using Query function

I'm trying to use Google Sheets to manage a database. I've figured out how to use the query function to do a simple search, but I'd like to know if an advanced search is possible. Here's what I mean:
Example I made (refer to the second sheet)
Each row has a number of attributes, and the search sheet has a number of fields that can be entered. I'd like to be able to search for one without having to keep the other fields filled in as well, but I'm not sure how to mess around with the query function to get what I need.
Any help would be very much appreciated. Thank you!
Where must only appear at the beginning of the filtering, not before every conditional.
This can be done with FILTER and some if statements or keep the query and adjust it similarly like this:
= IFERROR(
query(
Database!B3:G13,
"select B,C,D,E,F,G
where " &
IF(LEN($C$4), "lower(C) contains lower('"&$C$4&"')", "1=1") & " and " &
IF(LEN($E$4), "lower(D) contains lower('"&$E$4&"')", "1=1") & " and " &
IF(LEN($G$4), "lower(E) contains lower('"&$G$4&"')", "1=1") & " and " &
IF(LEN($I$4), "lower(F) contains lower('"&$I$4&"')", "1=1") & " and " &
IF(LEN($K$4), "lower(G) contains lower('"&$K$4&"')", "1=1")),
"No Results")
It essentially checks if the filter is specified and if not puts 1=1 (TRUE) as a placeholder.

Resources