Google Sheets - Is it possible to use query to search for the data from the sheets that i select with dropdown list? If not, what can i do? - sql

GoodDay everyone, recently I am trying to learn about using the Google Sheets. My question is same as the title, and these are some examples of the data.
The data from first sheet
The data from second sheet
I am trying to create a searching function in the main page in order to get some data by selecting a specific sheet.
And these are the result I expect to see.
By choosing option using the dropdown list, I expect the query or any other things will detect the option and display all the data I need from the sheet I have chosen.
RESULT EXPECTED 1
RESULT EXPECTED 2
RESULT EXPECTED 3
Is that even possible in Google Sheets?

use:
=INDEX(QUERY({
IFERROR(JACKIE!A4:A/0, "JACKIE"), JACKIE!A4:B;
IFERROR(KELVIN!A4:A/0, "KELVIN"), KELVIN!A4:B},
"where Col2 is not null
and Col1 = '"&B2&"'
and Col3 = '"&B3&"'", ))

Related

How to combine rows in BigQuery that share a similar name

i'm having trouble creating a query that'll group together responses from multiple rows that share a similar name and count the specific response record in them.
the datatable i currently have looks like this
test_control
values
test
selected
control
selected
test us
not selected
control us
selected
test mom
not selected
control mom
selected
what i'd like, is an output like the below that only counts the number of "selected" responses and groups together the rows that have either "control" or "test" in the name"
test_control
values
test
3
control
1
The query i have below is wrong as it doesn't give me an output of anything. The group by section is where im lost as i'm not sure how to do this. tried to google but couldn't seem to find anything. appreciate any help in advance!!!
SELECT distinct(test_control), values FROM `total_union`
where test_control="%test%" and values="selected"
group by test_control, values
use below
SELECT
REGEXP_EXTRACT(test_control, r'^(TEST|CONTROL) ') AS test_control,
COUNTIF(values = 'selected') AS values
FROM `total_union`
GROUP BY 1
As mentioned by #Mikhail Berlyant, you can use REGEX_EXTRACT to match the expression and COUNTIF to get the count of the total number of matching expressions according to the given condition. Try below code to get the expected output :
Code
SELECT
REGEXP_EXTRACT(test_control, r'^(test|control)') AS test_control,
COUNTIF(values = "selected") AS values
FROM `project.dataset.testvalues`
group by 1
Output

How to use a google sheets pivot query to output strings

I have a (much larger) table like this sample:
I am trying to output a table that looks like this:
The closest I can get with a pivot query returns numerical results in the value fields, rather than the desired text strings
=query(Data, "Select D,count(D) group by D Pivot B")
I resorted to a series of formulas to build my row and column headers, and then fill in the data field - See Version 3 in the sample sheet. But I couldn't figure out how to fill in the data with a single formula - as opposed to copying and pasting in the data field, which is not desirable with a dynamic number of row and column headers based on the original data.
Is there a way to wrap my data field formula (in cell B44 of the sample) in an arrayformula that will fill the data field, with a dynamic number of columns and rows?
Or even more advanced is there a formula that will deliver my desired results table in a single formula?
This should work, it's a bit difficult to explain, but i could demonstrate the various parts if you opened up your sheet to editable...
=ARRAYFORMULA(TRANSPOSE(QUERY(TRIM(SPLIT(TRANSPOSE(QUERY(QUERY({CHAR(10)&A2:A11,B2:B11&"|"&D2:D11&"|"},"select MAX(Col1) group by Col1 pivot Col2"),,9^9)),"|",0,0)),"select Col1,MAX(Col3) where Col1<>'' group by Col1 pivot Col2 order by Col1 desc label Col1'Project'")))

Retrieving Columns with count greater than 1 - Google Sheet Query

I'm using Google sheets, and I want to get the data from one sheet to another where I want only the columns with count > 1.
Let's say we have 3 columns A, B, and C. I tried the following (the first sheet name is "Form Responses 1"):
I thought about using a query in the second sheet as: =query('Form Responses 1'!A1:Z, "Select A having count (A) >1 union select B having count (B) >1 union select C having count (C) > 1"). But I got a parse error where it seems that union and having are not supported in google sheets query.
How can I achieve this (whether it's using query or any other Google sheets function that can work)?
More details:
The first sheet contains info about exercises conducted during a lecture and it gets its data from a Google Form (so the responses are fed in this sheet). Here is a screenshot of it:
Please note that the form is divided into sections. When the user selects the course, the attendance, the participation, and adds a comment, then they go to the next section, the next section will be based on the selected course, the newly opened section will have the exercise name and rating questions (the exercise name is a dropdown list with items that are prefilled and specific to the selected course). That's why, you can see that "exercise name" and "rate the exercise" columns are repeated because we have 2 sections in this form.
The second sheet should contain the data of a selected course only (either mobile dev or web dev) which can be achieved easily through a query with a where clause. But, in addition to that, it shouldn't contain the empty columns of "exercise name" and "rate the exercise" as they correspond to another section. So, it should have only one exercise name column and one rating column that correspond to the selected course. Here is a screenshot if we only use a query with where clause without removing the extra name and rating columns:
Here is a screenshot with the desired result:
Thanks.
why not use just:
=QUERY('Form Responses 1'!A1:Z, "select A,B,C,D,E,F,G where F is not null", 1)
Use "OR" condition
Eg:-
QUERY(Data!A:R,"select A, N, P where N>0 or P>0")
where A column has country and N, P columns have population values

VBA macro for excel. Mark row if cells in column A are the same but different in column C

I do not have any code yet as I dont know VBA that much or at all.
I got excell sheet with 4 columns. Column A is main group and C is subgroups within groups from column A.
i need to mark somehow rows where within same JobID, WFID is the same and where WFID is different within same JobID.
JobID TaskID WFID
39822 913914 Complete
39822 913915 no complete
37941 905439 Complete
37941 905440 Complete
Would you be able to help pleasE?
You do not really need macros to identify your rows.
Simply put this formula in a new column
=COUNTIFS($A$1:$A$8,A1,$C$1:$C$8,"<>"&C1)
Wherever there are different values in col C for same value of col A it will throw a 1 else 0
If you want to highlight, I recommend using conditional formatting based on the value of your new column with (0/1) values.
Hope this answers your query.

vb.net microsoft reportviewer - I need help to make a table fit in one page

How can I fill the page with empty table rows? For example; I have 2 records in the dataset but I want to the page with empty rows (draw the table borders until the end of page)
I have;
I want;
Are you getting your report data from a database? If so you might look at returning empty rows from your database call.
If you can describe your data source and query that you are using for this report, we might be able to suggest changes to the query to return blank rows.
UPDATE:
OK, Based on how you describe the data you are getting, perhaps you can change your database call to do something like this:
select * from Subeler where Subeler.FirmaId = 10
UNION ALL
select TOP 5 ' ' from Subeler where 1 = 1
That will give you your original data, plus 5 "blank" rows to help pad your report. Of course you would have to make sure the second query has the same number and type of columns as your first, but hopefully this will point you in the right direction.