=filter(query(Vendors!$A$3:$M,"select A,B,C,D,E,F,G,H,I,J,K,L,M",1),Vendors!$L$3:$L = "Invited",Vendors!$I$3:$I - Vendors!$G$3:$G <=$F$6)
I have the above formula that will query and return the results. However in all date columns I get a random number string instead of the date being referenced.
Query Results
I tried enabling data validation in one column to fromat as date.
Any advice on how to get the query to return the date instead of this number string? All of the other columns return text and numbers correctly.
Those are date numbers. Format those columns as dates from the sheet menu.
The query (as you specify) would return the date instead of the number string it you appropriately added a format clause. Exactly what that would be cannot be deduced from the little information you have provided.
Related
I was trying to use the following function;
=INDEX(D:D,COUNTA(D:D),1),
in order to get the last currency value of a column, but it returns #ERROR!.
The value im trying to extract
As I montly update this spreadsheet, it would make it very convenient if would etract the last value in the column, e.g. the value marked in the image.
Is there a way (in Google Sheets) to find the last non-empty cell in this column, such that when I update the spreadsheet with a new "last value" it would return that value?
The index(counta()) pattern will fail when the data is sparse, i.e., when there are blank values in the column.
The index(match()) pattern will fail when the data contains a value that is not a number.
To find the last non-blank value in column D, regardless of data type, use the +sort(row()) pattern:
=+sort(D1:D; not(isblank(D1:D)) * row(D1:D); false)
The formula uses semicolons as argument separators to make it work in any locale.
If the column has only currency (ie number) values then you can use something like:
=INDEX(D1:D, MATCH(999^99, D1:D))
or try:
=SORTN(D:D; 1;;ROW(D:D)*(D:D<>""); )
I have a simple data query in a Google Sheet:
=query('2019'!$A$2:$A,"select A")
The data in column A has multiple cells that contain comma-separated values. Only the data in the first cell (A2) returns with all of the comma-separated values. How do I get all of the data returned in this query?
It's very likely the problem is cause because the data without commas are of ty numbers, boolean, dates, time, duration, in other works, they are not text values.
This happens because QUERY assigns a data type for each column based on a sample of each column data. If the column includes data of different type, they aren't included.
The way to solve this is to prior adding the data to QUERY convert all the column values to the same data type, in this case all should be text. To force that all the values are treated as text you could preppend and apostrophe / single quote. Other methods are
set the cell number formatting to plain text
concatenate the cell value to an empty text "" like =A1&""
try like this:
=ARRAYFORMULA(QUERY(TO_TEXT(2019!A2:A), "select A", 0)
I have my dataset in Google spreadsheet and I wish to know the unique number of customers in a specific date range:
Let's say this is my data set
Customer Date
A 22/07/2017
B 24/07/2017
A 23/07/2017
I use this formula COUNT_DISTINCT(Customer) however because row 3 have different date from row 1 the output is 3 (however, I wish to have 2 as my output)
If you want to know the number of unique values in column A regardless of the date then would this formula work:
=COUNTUNIQUE(A2:A)
Or is you want to combine this with a specific date range then:
=COUNTUNIQUE(FILTER(A2:A,B2:B>=datefrom,B2:B<=dateto))
In this formula, datefrom and dateto can be either a value or a cell reference
I'm trying to query a range that returns only rows where the date in Column S is older than the date in Column D
All dates in the sheet are already formatted yyyy-mm-dd but I can't seem to find any suggestions on how to use WHERE with a range of dates, rather than either a single date or a specific cell.
=QUERY(Sheet1!A2:W11536,"select A,B,C,D,E,F,G,H,I,J,K where date '"&text(Sheet1!D2:D,"yyyy-mm-dd")&"' > date'"&text(Sheet1!S2:S,"yyyy-mm-dd")&"'")
This is giving me an N/A error: "Query completed with an empty output."
When I make it < rather than > it populates without error, though it's not showing the desired results. There should be valid data for >.
Thanks!
I think this is enough when you're comparing two columns
=query(A:H,"select A,B,C,D,E,F,G,H where C>H")
(although I couldn't find any rows that satisfied the criteria in your test sheet)
I think what is actually happening is that it is just comparing the first two dates so you either get all of the data or nothing.
Goal: Return a specific value from a table of data based on a query (kinda like if VLOOKUP provided the option for multiple criteria).
Problem: The data in the source table is a value and I can't change the data source's format. When I run my QUERY function I get #N/A. I know it's due to the data type of the source table data because when I update the format to "plain text" the value works.
Here is my Query:
=QUERY(SessionsData,"select D where B='"&TEXT(Date(YEAR(TODAY()),4,$A143),"yyyy-MM-dd")&"' limit 1",0)
I know the logic works, watch this video for a brief demo.
How can I get this comparison to return results?
Adapted from this answer:
The Query language has two functions to help with date comparisons.
The todate() scalar function will convert spreadsheet dates (like your column B) to query date values. If the value started as a datetime, it returns just the date portion.
The date modifier treats specifically formatted strings as query date values.
Use them like so:
=QUERY(SessionsData,"select D where todate(B)=date '"&TEXT(Date(YEAR(TODAY()),4,$A143),"yyyy-MM-dd")&"' limit 1",0)
^^^^^^^^^ ^^^^