Keep getting #VALUE! or #ERROR on everything I try, I think I'm using the wrong function entirely but don't know the best alternative.
I've tried a few IF blanks and what not but no luck, I've only just started on google sheets a few days ago.
I've tried a query I used on another sheet and changed it around a little, I had some success but with my lack of knowledge.... it didn't do everything I needed and it didn't work when I tried to use it involving all the sheets I needed, just a single sheet it worked for. I tried to search for something but I was just going in circles.
=QUERY({KME!$A$2:$D$157;'KME1'!$A$2:$D$157;'KME2'!$A$2:$D$157},"select * WHERE C < 300 OR D <10000",1)
=QUERY(KME!$A$2:$D$157,"select * WHERE C < 300 OR D <10000",1)
I have a set of data across 3 sheets. I need to filter the data, I want it to select all the data which I used select * for.
I want it to only show results from:
Column C if below 300
OR
Column D if below 10,000
I also want it to not show results that have empty cells in C and D
try it like this:
=QUERY({KME!A2:D157; 'KME1'!A2:D157; 'KME2'!A2:D157},
"where Col3 < 300
or Col4 < 10000
and Col3 !=''
and Col4 !='' ", 0)
or like this:
=QUERY(QUERY({KME!A2:D157;'KME1'!A2:D157;'KME2'!A2:D157},
"where Col3 < 300 OR Col4 <10000", 0),
"where Col3 is not null and Col4 is not null")
Related
In the following Google spreadsheet
Description
No. of participants
Severity
Problem 1
2
Minor
Problem 2
2
Major
Problem 3
1
Minor
Problem 4
1
Minor
Problem 5
2
Major
I would like to create a chart that has the No. of participants as x-axis, the Severity as y-axis and counts the number of combinations.
The example above would look like this:
1
2
Minor
2
1
Major
0
2
Also, I would like to list all items in the column description according to their combination of No. of participants and severity like this:
1
2
Minor
Problem 3
Problem 1
Minor
Problem 4
Major
Problem 2
Major
Problem 5
How can I get this chart extracted from the table in Google Sheets?
Thanks to #player0 the first part is answered. He also suggested something for the second part that does not quite work out yet:
To get the basic table:
=QUERY(A2:C6; "select C, max(A) where A is not null group by C pivot B order by C desc")
To display several items in one cell:
=MAP(B2:B6; C2:C6; LAMBDA(x; y; TEXTJOIN(CONCATENATE(CHAR(10);CHAR(10)); 1; FILTER(A2:A6; B2:B6=x; C2:C6=y))))
Unfortunately, combining both does not work out:
=QUERY((MAP(B2:B6; C2:C6; LAMBDA(x; y; TEXTJOIN(CONCATENATE(CHAR(10);CHAR(10)); 1; FILTER(A2:A6; B2:B6=x; C2:C6=y)))); B2:C6); "select C,max(A) where A is not null group by C pivot B order by C desc")
Nor does this one work:
=QUERY((MAP(B2:B6; C2:C6; LAMBDA(x; y; TEXTJOIN(CONCATENATE(CHAR(10);CHAR(10)); 1; FILTER(A2:A6; B2:B6=x; C2:C6=y)))); B2:C6); "select Col1,max(Col1) where Col1 is not null group by Col3 pivot Col2 order by Col3 desc")
use:
=QUERY(A2:C; "select C,count(A) where A is not null group by C pivot B order by C desc")
update:
=QUERY({MAP(B2:B, C2:C, LAMBDA(x, y, TEXTJOIN(", ", 1, FILTER(A2:A, B2:B=x, C2:C=y)))), B2:C},
"select Col3,max(Col1) where Col1 is not null group by Col3 pivot Col2 order by Col3 desc")
So I have this function
=QUERY({PAScore;DetPA;DetLabel}, "SELECT Col3 WHERE Col2 < '" & Input!P31 & "' LIMIT 1", 0)
That's meant to return a string from DetLabel or Col3 where DetPA or Col2 is less than Input!P31(which is located in PAScore). Instead, I get an error message that says "Unable to parse query string for Function QUERY parameter 2: NO_COLUMN: Col3."
DetPA and DetLabel are on the same sheet while PAScore is on a different one. DetLabel contains strings while the other two contain values.
I've been messing around with this for a couple of hours now and can't seem to figure it out, so if anyone knows what's wrong, any help would be appreciated!
If more info is needed, please let me know! I'll do my best to provide it :)
As requested, here is a copy of the sheet. The formula in question is on sheet Data in cell B31. The purpose of this formula is to do basically the same thing the cells above it do, but without the formatting and with a simpler and more adjustable formula.
https://docs.google.com/spreadsheets/d/1gKfEJzR4lvQJJUoA1tqYF4jMSgj2VApLQ-jnGgK3_CM/edit?usp=sharing
The accepted answer solved my problem, but for anyone else reading with a similar problem, I did have to change the ranges so that they all had the same amount of rows :D
asuming that each of {PAScore; DetPA; DetLabel} has 3 columns and Input!P31 is numeric, use:
=QUERY({PAScore; DetPA; DetLabel},
"select Col3
where Col2 < "&Input!P31&"
limit 1", 0)
if each of {PAScore; DetPA; DetLabel} has sonly one column use:
=QUERY({PAScore, DetPA, DetLabel},
"select Col3
where Col2 < "&Input!P31&"
limit 1", 0)
Hello I need help with a formula. I want to pull certain information from all 3 sheets and putting it on another google sheet spreadsheet.
Example of the info I need is all of Driver Bs information from Column A, E, F, H, I, K from week 6.There is more information on Sheet 2 and 3 from that week also that needs to be pulled.
I have this idea for the formula. I put U without a number next to it because there is rows of information constantly being added to the google docs.
=IMPORTRANGE("https google sheet goes here","Sheet1!A1:U" "Sheet2!A1:U" "Sheet3!A1:U"}, "where Col4 = 'Driver A'", "where Col21 = '6'", 0)
try:
=QUERY({
IMPORTRANGE("1tnAtFgxCl2DnyYL0cjzijsqw8WlvC1BxI80hduaPwi0", "Sheet1!A1:U");
IMPORTRANGE("1tnAtFgxCl2DnyYL0cjzijsqw8WlvC1BxI80hduaPwi0", "Sheet2!A1:U");
IMPORTRANGE("1tnAtFgxCl2DnyYL0cjzijsqw8WlvC1BxI80hduaPwi0", "Sheet3!A1:U")},
"select Col1,Col5,Col6,Col8,Col9,Col11
where Col4 = 'Driver A'
and Col21 = 12", 1)
Link To Sheet
So I've got an array formula which I've included below. I need to adjust this so that it becomes a weighted average based on variables stored on a sheet titled Variables.
Current Formula:
=ARRAYFORMULA(QUERY(
{PROPER(ADP!A3:A),ADP!E3:S;
PROPER(ADP!J3:J),ADP!S3:S;
PROPER(ADP!Z3:Z),ADP!AG3:AG},
"select Col1, Sum(Col2)
where
Col2 is not null and
Col1 is not null
group by Col1
order by Sum(Col2)
label
Col1 'PLAYER',
Sum(Col2) 'ADP AVG'"))
Here's what I thought would work but doesn't:
=ARRAYFORMULA(QUERY(
{PROPER(ADP!A3:A),ADP!E3:E*(Variables!$F$11/Variables!$F$14);
PROPER(ADP!J3:J),ADP!S3:S*(Variables!$F$12/Variables!$F$14);
PROPER(ADP!Z3:Z),ADP!AG3:AG*(Variables!$F$13/Variables!$F$14)},
"select Col1, Sum(Col2)
where
Col2 is not null and
Col1 is not null
group by Col1
order by Sum(Col2)
label
Col1 'PLAYER',
Sum(Col2) 'ADP AVG'"))
What I'm trying to get is the value pulled in K to be multiplied by the value in VariablesF11, the value pulled in Y to be multiplied by VariablesF12, and the value in AL multiplied by the variables in F13. And have that numerator divided by the value in VariablesF14.
After our extensive chat, I'm providing here the answer we came up with, just on the chance it might somehow help someone else. But the issue in your case was less about the technicalities of the formula, and more about the structuring of multiple data sources, and the associated logic to pull the data together.
Here is the main formula:
={"Adjusted
Ranking
by " & Variables!F21;
arrayformula(
if(A2:A<>"",
( if(((D2:D>0) * Source1Used),D2:D,Variables!$F$21)*Variables!$F$12
+ if(((F2:F>0) * Source2Used),F2:F,Variables!$F$21)*Variables!$F$13
+ if(((H2:H>0) * Source3Used),H2:H,Variables!$F$21)*Variables!$F$14
+ if(((J2:J>0) * Source4Used),J2:J,Variables!$F$21)*Variables!$F$15
+ if(((L2:L>0) * Source5Used),L2:L,Variables!$F$21)*Variables!$F$16
+ if(((N2:N>0) * Source6Used),N2:N,Variables!$F$21)*Variables!$F$17 )) / Variables!$F$18) }
A2:A is the list of players' names. The D2:D>0 is a test of whether that player has a rating obtained from a particular data source.
Source1Used is a named range for a tickbox cell, where the user can indicate whether that data source is to be included in the calculations.
This formula creates an average value, using from 1 to 6 possible sources, user selectable.
The formula that gave the rating value for one specific source is as follows:
={"Rating in
Source1";ArrayFormula(if(A2:A<>"",if(C2:C,vlookup(A2:A,indirect("ADP!$" & ADP!E3 & "$10:" & ADP!E5),ADP!E6-ADP!E4+1,0),0),""))}
This takes a name in column A, checks if it is listed in a specific source's data, and if so, it pulls back the rating value from the data source. INDIRECT is used since the column locations for each data source may vary, but are obtained from a fixed table, in cells ADP!E3 and E5. E4 and E6 are the numeric values of the column letters.
I'm using this Levenshtein function for T-SQL which works well (I'm not worried about performance). Now I want to write a query that returns all rows where the Levenshtein distance is less than x (where x might be 5 for example) using the Company name field to do the comparison.
I've tried the following, but it returns thousands of duplicate rows.
SELECT * FROM Contacts c1, Contacts c2
WHERE dbo.ufnCompareString(c1.Company, c2.Company) < 5
AND c1.id <> c2.id
I would like it to show a list like this:
1 Apple Experts
20 Apple Experts Inc.
240 H&K Paving
21 H and K Paving
98 HK Paving
189 H.K. Paving
5 J.M. Lawn Care
105 JM Lawn Care
Is it possible to do something like this? What am I doing wrong?
EDIT
I ended up with a query that looks something like this. I found that there were some "invalid" entries causing the problems I was having:
SELECT c1.ContactId, c1.Company, c1.LastName, c1.FirstName,
c2.ContactId, c2.Company, c2.LastName, c2.FirstName
FROM Contacts c1, Contacts c2
WHERE Cast(c1.ContactId AS INT) < Cast(c2.ContactId AS INT)
AND c1.Company IS NOT NULL
AND Replace(c1.Company, ' ', '') <> ''
AND c2.Company IS NOT NULL
AND Replace(c2.Company, ' ', '') <> ''
AND Len(c1.Company) > 6
AND Len(c2.Company) > 6
AND dbo.ufnCompareString(c1.Company, c2.Company) < 5
Note that the query is pretty slow running (on about 12,000 records) and I also have a different query that is more effective. The goal was to find duplicate companies that had been entered using slightly different company names and this query returned too many false positives. As to the query I actually used, it's too complicated to show here and outside the scope of this question.
To reduce the duplicates, use this instead:
SELECT * FROM Contacts c1, Contacts c2
WHERE dbo.ufnCompareString(c1.Company, c2.Company) < 5
AND c1.id < c2.id
It returns all unique pairs of contacts, whose distance is less than 5.
The query you have there should work properly, if you are getting duplicates look at the content of the Contacts table.