Google sheets double query with selecting cell value as an explicit where condition
I have the following dataset:
Start day End Day Product ID Sells Unites
01/11/2018 08/11/2018 Blue DA_1000 $55,555.00 12
01/11/2018 08/11/2018 Red DA_1000 $1,321,321.00 55555
01/11/2018 08/11/2018 Blue DA_1000 $444.00 11111
01/11/2018 08/11/2018 Green DA_1000 $1,313,121.00 24
01/11/2018 08/11/2018 Aspire DA_1001 $11.00 55555
09/11/2018 16/11/2018 Black DA_1001 $786.13 49
09/11/2018 16/11/2018 Apple DA_1001 $629.55 22
09/11/2018 16/11/2018 White DA_1001 $0.39 1
17/11/2018 24/11/2018 Orange DA_1002 $0.00 515413
17/11/2018 24/11/2018 Blue DA_1002 $569.35 42
17/11/2018 24/11/2018 Red DA_1003 $315,154.00 40
25/11/2018 30/11/2018 White DA_1003 $45,464,564.00 36
25/11/2018 30/11/2018 Black DA_1003 $490.41 42
25/11/2018 30/11/2018 Vol DA_1004 $435.61 55
And I want to query from the products that have sells equal to=444, from this query I want to query again all of those that they're ID is equal to "DA_1000". and I managed to do that. But when I trying inserting to the where condition the explicit cell value I can't get any result,
This is the working query:
=query({query(A1:F15,"Select * Where E=444",1)},Select * Where Col4='DA_1000',1)
This is the non-working query:
=query({query(A1:F15,"Select * Where E=444",1)},Select * Where Col4='TEST!N6',1)
This is the url for the google sheet.
Please assist.
google-sheets google-sheets-query
add a comment |
I have the following dataset:
Start day End Day Product ID Sells Unites
01/11/2018 08/11/2018 Blue DA_1000 $55,555.00 12
01/11/2018 08/11/2018 Red DA_1000 $1,321,321.00 55555
01/11/2018 08/11/2018 Blue DA_1000 $444.00 11111
01/11/2018 08/11/2018 Green DA_1000 $1,313,121.00 24
01/11/2018 08/11/2018 Aspire DA_1001 $11.00 55555
09/11/2018 16/11/2018 Black DA_1001 $786.13 49
09/11/2018 16/11/2018 Apple DA_1001 $629.55 22
09/11/2018 16/11/2018 White DA_1001 $0.39 1
17/11/2018 24/11/2018 Orange DA_1002 $0.00 515413
17/11/2018 24/11/2018 Blue DA_1002 $569.35 42
17/11/2018 24/11/2018 Red DA_1003 $315,154.00 40
25/11/2018 30/11/2018 White DA_1003 $45,464,564.00 36
25/11/2018 30/11/2018 Black DA_1003 $490.41 42
25/11/2018 30/11/2018 Vol DA_1004 $435.61 55
And I want to query from the products that have sells equal to=444, from this query I want to query again all of those that they're ID is equal to "DA_1000". and I managed to do that. But when I trying inserting to the where condition the explicit cell value I can't get any result,
This is the working query:
=query({query(A1:F15,"Select * Where E=444",1)},Select * Where Col4='DA_1000',1)
This is the non-working query:
=query({query(A1:F15,"Select * Where E=444",1)},Select * Where Col4='TEST!N6',1)
This is the url for the google sheet.
Please assist.
google-sheets google-sheets-query
add a comment |
I have the following dataset:
Start day End Day Product ID Sells Unites
01/11/2018 08/11/2018 Blue DA_1000 $55,555.00 12
01/11/2018 08/11/2018 Red DA_1000 $1,321,321.00 55555
01/11/2018 08/11/2018 Blue DA_1000 $444.00 11111
01/11/2018 08/11/2018 Green DA_1000 $1,313,121.00 24
01/11/2018 08/11/2018 Aspire DA_1001 $11.00 55555
09/11/2018 16/11/2018 Black DA_1001 $786.13 49
09/11/2018 16/11/2018 Apple DA_1001 $629.55 22
09/11/2018 16/11/2018 White DA_1001 $0.39 1
17/11/2018 24/11/2018 Orange DA_1002 $0.00 515413
17/11/2018 24/11/2018 Blue DA_1002 $569.35 42
17/11/2018 24/11/2018 Red DA_1003 $315,154.00 40
25/11/2018 30/11/2018 White DA_1003 $45,464,564.00 36
25/11/2018 30/11/2018 Black DA_1003 $490.41 42
25/11/2018 30/11/2018 Vol DA_1004 $435.61 55
And I want to query from the products that have sells equal to=444, from this query I want to query again all of those that they're ID is equal to "DA_1000". and I managed to do that. But when I trying inserting to the where condition the explicit cell value I can't get any result,
This is the working query:
=query({query(A1:F15,"Select * Where E=444",1)},Select * Where Col4='DA_1000',1)
This is the non-working query:
=query({query(A1:F15,"Select * Where E=444",1)},Select * Where Col4='TEST!N6',1)
This is the url for the google sheet.
Please assist.
google-sheets google-sheets-query
I have the following dataset:
Start day End Day Product ID Sells Unites
01/11/2018 08/11/2018 Blue DA_1000 $55,555.00 12
01/11/2018 08/11/2018 Red DA_1000 $1,321,321.00 55555
01/11/2018 08/11/2018 Blue DA_1000 $444.00 11111
01/11/2018 08/11/2018 Green DA_1000 $1,313,121.00 24
01/11/2018 08/11/2018 Aspire DA_1001 $11.00 55555
09/11/2018 16/11/2018 Black DA_1001 $786.13 49
09/11/2018 16/11/2018 Apple DA_1001 $629.55 22
09/11/2018 16/11/2018 White DA_1001 $0.39 1
17/11/2018 24/11/2018 Orange DA_1002 $0.00 515413
17/11/2018 24/11/2018 Blue DA_1002 $569.35 42
17/11/2018 24/11/2018 Red DA_1003 $315,154.00 40
25/11/2018 30/11/2018 White DA_1003 $45,464,564.00 36
25/11/2018 30/11/2018 Black DA_1003 $490.41 42
25/11/2018 30/11/2018 Vol DA_1004 $435.61 55
And I want to query from the products that have sells equal to=444, from this query I want to query again all of those that they're ID is equal to "DA_1000". and I managed to do that. But when I trying inserting to the where condition the explicit cell value I can't get any result,
This is the working query:
=query({query(A1:F15,"Select * Where E=444",1)},Select * Where Col4='DA_1000',1)
This is the non-working query:
=query({query(A1:F15,"Select * Where E=444",1)},Select * Where Col4='TEST!N6',1)
This is the url for the google sheet.
Please assist.
google-sheets google-sheets-query
google-sheets google-sheets-query
edited Nov 21 '18 at 15:52
pushkin
4,073112753
4,073112753
asked Nov 21 '18 at 9:15
RaphaRapha
85
85
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
If you would want the select-clause in a cell (ex: H10) you'd have to write in this cell:
="Select * Where Col4='"&TEST!N6&"'"
Then in your query:
=query({query(A1:F15,"Select * Where E=444",1)},H10,1)
Note that this can also be done in one query by writing in the reference cell
=" and D='"&TEST!N6&"'"
and then your query would look like this:
=query(A1:F15,"Select * Where E=444"&H10,1)
This works, but this was a simplification. In a more complex query, aka: [SELECT P,Q,SUM(R),SUM(S),SUM(T),SUM(R)/SUM(S),SUM(R)/SUM(T),SUM(T)/SUM(S) GROUP BY P,Q order by Q] replacing the the part of the original: query(A1:F15,"Select * Where E=444",1). I can't seem to utilise the same concept
– Rapha
Nov 21 '18 at 12:26
add a comment |
Maybe:
=query(A:F,"where E=444 and D contains 'DA_1000'")
would serve.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53408662%2fgoogle-sheets-double-query-with-selecting-cell-value-as-an-explicit-where-condit%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you would want the select-clause in a cell (ex: H10) you'd have to write in this cell:
="Select * Where Col4='"&TEST!N6&"'"
Then in your query:
=query({query(A1:F15,"Select * Where E=444",1)},H10,1)
Note that this can also be done in one query by writing in the reference cell
=" and D='"&TEST!N6&"'"
and then your query would look like this:
=query(A1:F15,"Select * Where E=444"&H10,1)
This works, but this was a simplification. In a more complex query, aka: [SELECT P,Q,SUM(R),SUM(S),SUM(T),SUM(R)/SUM(S),SUM(R)/SUM(T),SUM(T)/SUM(S) GROUP BY P,Q order by Q] replacing the the part of the original: query(A1:F15,"Select * Where E=444",1). I can't seem to utilise the same concept
– Rapha
Nov 21 '18 at 12:26
add a comment |
If you would want the select-clause in a cell (ex: H10) you'd have to write in this cell:
="Select * Where Col4='"&TEST!N6&"'"
Then in your query:
=query({query(A1:F15,"Select * Where E=444",1)},H10,1)
Note that this can also be done in one query by writing in the reference cell
=" and D='"&TEST!N6&"'"
and then your query would look like this:
=query(A1:F15,"Select * Where E=444"&H10,1)
This works, but this was a simplification. In a more complex query, aka: [SELECT P,Q,SUM(R),SUM(S),SUM(T),SUM(R)/SUM(S),SUM(R)/SUM(T),SUM(T)/SUM(S) GROUP BY P,Q order by Q] replacing the the part of the original: query(A1:F15,"Select * Where E=444",1). I can't seem to utilise the same concept
– Rapha
Nov 21 '18 at 12:26
add a comment |
If you would want the select-clause in a cell (ex: H10) you'd have to write in this cell:
="Select * Where Col4='"&TEST!N6&"'"
Then in your query:
=query({query(A1:F15,"Select * Where E=444",1)},H10,1)
Note that this can also be done in one query by writing in the reference cell
=" and D='"&TEST!N6&"'"
and then your query would look like this:
=query(A1:F15,"Select * Where E=444"&H10,1)
If you would want the select-clause in a cell (ex: H10) you'd have to write in this cell:
="Select * Where Col4='"&TEST!N6&"'"
Then in your query:
=query({query(A1:F15,"Select * Where E=444",1)},H10,1)
Note that this can also be done in one query by writing in the reference cell
=" and D='"&TEST!N6&"'"
and then your query would look like this:
=query(A1:F15,"Select * Where E=444"&H10,1)
answered Nov 21 '18 at 11:14
JPVJPV
11.4k21526
11.4k21526
This works, but this was a simplification. In a more complex query, aka: [SELECT P,Q,SUM(R),SUM(S),SUM(T),SUM(R)/SUM(S),SUM(R)/SUM(T),SUM(T)/SUM(S) GROUP BY P,Q order by Q] replacing the the part of the original: query(A1:F15,"Select * Where E=444",1). I can't seem to utilise the same concept
– Rapha
Nov 21 '18 at 12:26
add a comment |
This works, but this was a simplification. In a more complex query, aka: [SELECT P,Q,SUM(R),SUM(S),SUM(T),SUM(R)/SUM(S),SUM(R)/SUM(T),SUM(T)/SUM(S) GROUP BY P,Q order by Q] replacing the the part of the original: query(A1:F15,"Select * Where E=444",1). I can't seem to utilise the same concept
– Rapha
Nov 21 '18 at 12:26
This works, but this was a simplification. In a more complex query, aka: [SELECT P,Q,SUM(R),SUM(S),SUM(T),SUM(R)/SUM(S),SUM(R)/SUM(T),SUM(T)/SUM(S) GROUP BY P,Q order by Q] replacing the the part of the original: query(A1:F15,"Select * Where E=444",1). I can't seem to utilise the same concept
– Rapha
Nov 21 '18 at 12:26
This works, but this was a simplification. In a more complex query, aka: [SELECT P,Q,SUM(R),SUM(S),SUM(T),SUM(R)/SUM(S),SUM(R)/SUM(T),SUM(T)/SUM(S) GROUP BY P,Q order by Q] replacing the the part of the original: query(A1:F15,"Select * Where E=444",1). I can't seem to utilise the same concept
– Rapha
Nov 21 '18 at 12:26
add a comment |
Maybe:
=query(A:F,"where E=444 and D contains 'DA_1000'")
would serve.
add a comment |
Maybe:
=query(A:F,"where E=444 and D contains 'DA_1000'")
would serve.
add a comment |
Maybe:
=query(A:F,"where E=444 and D contains 'DA_1000'")
would serve.
Maybe:
=query(A:F,"where E=444 and D contains 'DA_1000'")
would serve.
answered Nov 21 '18 at 15:21
pnutspnuts
48.8k76399
48.8k76399
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53408662%2fgoogle-sheets-double-query-with-selecting-cell-value-as-an-explicit-where-condit%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown