if (and) combination produces youve entered too many arguments for this function
I have created following Formula, but it does not works:
=IF(AND(G2<41,L2<41),4,IF(AND(G2>40,G2<81),AND(L2>40,L2<81),5,IF(AND(G2>80,L2>80),6,IF(AND(G2>41,G2>81),AND(L2>80),7,IF(AND(G2<41,L2>40),AND(L2<81),8,IF(AND(G2<41,L2>80),9,IF(AND(G2>80,L2>40),AND(L2<81),3,IF(AND(G2>40,G2<81),AND(L2<41),2,IF(G2>81,L2<41),1,0)
Can anyone help me to improve the formula?
microsoft-excel
add a comment |
I have created following Formula, but it does not works:
=IF(AND(G2<41,L2<41),4,IF(AND(G2>40,G2<81),AND(L2>40,L2<81),5,IF(AND(G2>80,L2>80),6,IF(AND(G2>41,G2>81),AND(L2>80),7,IF(AND(G2<41,L2>40),AND(L2<81),8,IF(AND(G2<41,L2>80),9,IF(AND(G2>80,L2>40),AND(L2<81),3,IF(AND(G2>40,G2<81),AND(L2<41),2,IF(G2>81,L2<41),1,0)
Can anyone help me to improve the formula?
microsoft-excel
present you set of input values of G and L as a normal table, without the formula, for easy understanding of what values should result in what output.
– VSRawat
Feb 9 at 15:08
add a comment |
I have created following Formula, but it does not works:
=IF(AND(G2<41,L2<41),4,IF(AND(G2>40,G2<81),AND(L2>40,L2<81),5,IF(AND(G2>80,L2>80),6,IF(AND(G2>41,G2>81),AND(L2>80),7,IF(AND(G2<41,L2>40),AND(L2<81),8,IF(AND(G2<41,L2>80),9,IF(AND(G2>80,L2>40),AND(L2<81),3,IF(AND(G2>40,G2<81),AND(L2<41),2,IF(G2>81,L2<41),1,0)
Can anyone help me to improve the formula?
microsoft-excel
I have created following Formula, but it does not works:
=IF(AND(G2<41,L2<41),4,IF(AND(G2>40,G2<81),AND(L2>40,L2<81),5,IF(AND(G2>80,L2>80),6,IF(AND(G2>41,G2>81),AND(L2>80),7,IF(AND(G2<41,L2>40),AND(L2<81),8,IF(AND(G2<41,L2>80),9,IF(AND(G2>80,L2>40),AND(L2<81),3,IF(AND(G2>40,G2<81),AND(L2<41),2,IF(G2>81,L2<41),1,0)
Can anyone help me to improve the formula?
microsoft-excel
microsoft-excel
edited Mar 9 at 6:31
Rajesh S
4,2832524
4,2832524
asked Feb 9 at 14:49
Pavel FedotovPavel Fedotov
1
1
present you set of input values of G and L as a normal table, without the formula, for easy understanding of what values should result in what output.
– VSRawat
Feb 9 at 15:08
add a comment |
present you set of input values of G and L as a normal table, without the formula, for easy understanding of what values should result in what output.
– VSRawat
Feb 9 at 15:08
present you set of input values of G and L as a normal table, without the formula, for easy understanding of what values should result in what output.
– VSRawat
Feb 9 at 15:08
present you set of input values of G and L as a normal table, without the formula, for easy understanding of what values should result in what output.
– VSRawat
Feb 9 at 15:08
add a comment |
3 Answers
3
active
oldest
votes
As AND is a binary operator requiring at least two argument to test that both are true, there four constructs having single conditions are wrong:
AND(L2>80), AND(L2<81), AND(L2<81), AND(L2<41)
in constructs like
AND(G2>41,G2>81)
that will hold true only if G2>81, so the first part, G2>41, is unnecessary, unless it should be AND(G2>41,G2<81)
for wrong constructs like
IF(AND(G2>41,G2<81),AND(L2>80)
You should use
IF( AND( AND(G2>41,G2<81),L2>80))
That will first test that G2 is >41 as well as <81, and if that holds it will also check whether L2 is also >80
add a comment |
If you take the single-digit numbers as intended for "result" for true tests, and then format the expression (formula) like this:
=IF(
AND(G2<41,L2<41),4,
# else
IF(AND(G2>40,G2<81),AND(L2>40,L2<81),5,
# else
IF(AND(G2>80,L2>80),6,
# else
IF(AND(G2>41,G2>81),AND(L2>80),7,
#else
IF(AND(G2<41,L2>40),AND(L2<81),8,
# else
IF(AND(G2<41,L2>80),9,
#else
IF(AND(G2>80,L2>40),AND(L2<81),3,
#else
IF(AND(G2>40,G2<81),AND(L2<41),2,
# else
IF(G2>81,L2<41),1,
# else
0)
... then it should be quite clear where the problem(s) exist.
Note that IF() takes ONE expression and tries whether it is TRUE or FALSE, returning the corresponding one of the two remaining arguments.
I'd recommend expressions/formulas to be kept as short as possible - it is very easy to end up with "a mess" otherwise - example here.
This is very similar to the situation where "smart code" is used for programming, i.e. where the remedy is: "KISS" (Keep it simple stupid).
add a comment |
Your Formula should written like this:
=IF(AND(G2<41,L2<41),4,IF(AND(G2>40,G2<81,L2>40,L2<81),5,IF(AND(G2>80,L2>80),6,IF(AND(G2>41,G2<=81,L2>80),7,IF(AND(G2<41,L2>40,L2<81),8,IF(AND(G2<41,L2>80),9,IF(AND(G2>80,L2>40,L2<81),3,IF(AND(G2>40,G2<81,L2<41),2,IF(AND(G2>81,L2<41),1,0)))))))))
Note:
- I've done little modification and instead of
IF(AND(G2>41,G2>81,L2>80),7
I've written like this,
IF(AND(G2>41,G2<=81,L2>80),7
because the previous logic And(G2>80, L2>80)
for 6
was contradicting with IF(AND(G2>41,G2>81,L2>80),7
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
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%2fsuperuser.com%2fquestions%2f1403888%2fif-and-combination-produces-youve-entered-too-many-arguments-for-this-function%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
As AND is a binary operator requiring at least two argument to test that both are true, there four constructs having single conditions are wrong:
AND(L2>80), AND(L2<81), AND(L2<81), AND(L2<41)
in constructs like
AND(G2>41,G2>81)
that will hold true only if G2>81, so the first part, G2>41, is unnecessary, unless it should be AND(G2>41,G2<81)
for wrong constructs like
IF(AND(G2>41,G2<81),AND(L2>80)
You should use
IF( AND( AND(G2>41,G2<81),L2>80))
That will first test that G2 is >41 as well as <81, and if that holds it will also check whether L2 is also >80
add a comment |
As AND is a binary operator requiring at least two argument to test that both are true, there four constructs having single conditions are wrong:
AND(L2>80), AND(L2<81), AND(L2<81), AND(L2<41)
in constructs like
AND(G2>41,G2>81)
that will hold true only if G2>81, so the first part, G2>41, is unnecessary, unless it should be AND(G2>41,G2<81)
for wrong constructs like
IF(AND(G2>41,G2<81),AND(L2>80)
You should use
IF( AND( AND(G2>41,G2<81),L2>80))
That will first test that G2 is >41 as well as <81, and if that holds it will also check whether L2 is also >80
add a comment |
As AND is a binary operator requiring at least two argument to test that both are true, there four constructs having single conditions are wrong:
AND(L2>80), AND(L2<81), AND(L2<81), AND(L2<41)
in constructs like
AND(G2>41,G2>81)
that will hold true only if G2>81, so the first part, G2>41, is unnecessary, unless it should be AND(G2>41,G2<81)
for wrong constructs like
IF(AND(G2>41,G2<81),AND(L2>80)
You should use
IF( AND( AND(G2>41,G2<81),L2>80))
That will first test that G2 is >41 as well as <81, and if that holds it will also check whether L2 is also >80
As AND is a binary operator requiring at least two argument to test that both are true, there four constructs having single conditions are wrong:
AND(L2>80), AND(L2<81), AND(L2<81), AND(L2<41)
in constructs like
AND(G2>41,G2>81)
that will hold true only if G2>81, so the first part, G2>41, is unnecessary, unless it should be AND(G2>41,G2<81)
for wrong constructs like
IF(AND(G2>41,G2<81),AND(L2>80)
You should use
IF( AND( AND(G2>41,G2<81),L2>80))
That will first test that G2 is >41 as well as <81, and if that holds it will also check whether L2 is also >80
edited Feb 9 at 15:12
answered Feb 9 at 15:02
VSRawatVSRawat
15512
15512
add a comment |
add a comment |
If you take the single-digit numbers as intended for "result" for true tests, and then format the expression (formula) like this:
=IF(
AND(G2<41,L2<41),4,
# else
IF(AND(G2>40,G2<81),AND(L2>40,L2<81),5,
# else
IF(AND(G2>80,L2>80),6,
# else
IF(AND(G2>41,G2>81),AND(L2>80),7,
#else
IF(AND(G2<41,L2>40),AND(L2<81),8,
# else
IF(AND(G2<41,L2>80),9,
#else
IF(AND(G2>80,L2>40),AND(L2<81),3,
#else
IF(AND(G2>40,G2<81),AND(L2<41),2,
# else
IF(G2>81,L2<41),1,
# else
0)
... then it should be quite clear where the problem(s) exist.
Note that IF() takes ONE expression and tries whether it is TRUE or FALSE, returning the corresponding one of the two remaining arguments.
I'd recommend expressions/formulas to be kept as short as possible - it is very easy to end up with "a mess" otherwise - example here.
This is very similar to the situation where "smart code" is used for programming, i.e. where the remedy is: "KISS" (Keep it simple stupid).
add a comment |
If you take the single-digit numbers as intended for "result" for true tests, and then format the expression (formula) like this:
=IF(
AND(G2<41,L2<41),4,
# else
IF(AND(G2>40,G2<81),AND(L2>40,L2<81),5,
# else
IF(AND(G2>80,L2>80),6,
# else
IF(AND(G2>41,G2>81),AND(L2>80),7,
#else
IF(AND(G2<41,L2>40),AND(L2<81),8,
# else
IF(AND(G2<41,L2>80),9,
#else
IF(AND(G2>80,L2>40),AND(L2<81),3,
#else
IF(AND(G2>40,G2<81),AND(L2<41),2,
# else
IF(G2>81,L2<41),1,
# else
0)
... then it should be quite clear where the problem(s) exist.
Note that IF() takes ONE expression and tries whether it is TRUE or FALSE, returning the corresponding one of the two remaining arguments.
I'd recommend expressions/formulas to be kept as short as possible - it is very easy to end up with "a mess" otherwise - example here.
This is very similar to the situation where "smart code" is used for programming, i.e. where the remedy is: "KISS" (Keep it simple stupid).
add a comment |
If you take the single-digit numbers as intended for "result" for true tests, and then format the expression (formula) like this:
=IF(
AND(G2<41,L2<41),4,
# else
IF(AND(G2>40,G2<81),AND(L2>40,L2<81),5,
# else
IF(AND(G2>80,L2>80),6,
# else
IF(AND(G2>41,G2>81),AND(L2>80),7,
#else
IF(AND(G2<41,L2>40),AND(L2<81),8,
# else
IF(AND(G2<41,L2>80),9,
#else
IF(AND(G2>80,L2>40),AND(L2<81),3,
#else
IF(AND(G2>40,G2<81),AND(L2<41),2,
# else
IF(G2>81,L2<41),1,
# else
0)
... then it should be quite clear where the problem(s) exist.
Note that IF() takes ONE expression and tries whether it is TRUE or FALSE, returning the corresponding one of the two remaining arguments.
I'd recommend expressions/formulas to be kept as short as possible - it is very easy to end up with "a mess" otherwise - example here.
This is very similar to the situation where "smart code" is used for programming, i.e. where the remedy is: "KISS" (Keep it simple stupid).
If you take the single-digit numbers as intended for "result" for true tests, and then format the expression (formula) like this:
=IF(
AND(G2<41,L2<41),4,
# else
IF(AND(G2>40,G2<81),AND(L2>40,L2<81),5,
# else
IF(AND(G2>80,L2>80),6,
# else
IF(AND(G2>41,G2>81),AND(L2>80),7,
#else
IF(AND(G2<41,L2>40),AND(L2<81),8,
# else
IF(AND(G2<41,L2>80),9,
#else
IF(AND(G2>80,L2>40),AND(L2<81),3,
#else
IF(AND(G2>40,G2<81),AND(L2<41),2,
# else
IF(G2>81,L2<41),1,
# else
0)
... then it should be quite clear where the problem(s) exist.
Note that IF() takes ONE expression and tries whether it is TRUE or FALSE, returning the corresponding one of the two remaining arguments.
I'd recommend expressions/formulas to be kept as short as possible - it is very easy to end up with "a mess" otherwise - example here.
This is very similar to the situation where "smart code" is used for programming, i.e. where the remedy is: "KISS" (Keep it simple stupid).
edited Mar 9 at 6:18
answered Feb 9 at 15:32
HannuHannu
4,1751925
4,1751925
add a comment |
add a comment |
Your Formula should written like this:
=IF(AND(G2<41,L2<41),4,IF(AND(G2>40,G2<81,L2>40,L2<81),5,IF(AND(G2>80,L2>80),6,IF(AND(G2>41,G2<=81,L2>80),7,IF(AND(G2<41,L2>40,L2<81),8,IF(AND(G2<41,L2>80),9,IF(AND(G2>80,L2>40,L2<81),3,IF(AND(G2>40,G2<81,L2<41),2,IF(AND(G2>81,L2<41),1,0)))))))))
Note:
- I've done little modification and instead of
IF(AND(G2>41,G2>81,L2>80),7
I've written like this,
IF(AND(G2>41,G2<=81,L2>80),7
because the previous logic And(G2>80, L2>80)
for 6
was contradicting with IF(AND(G2>41,G2>81,L2>80),7
add a comment |
Your Formula should written like this:
=IF(AND(G2<41,L2<41),4,IF(AND(G2>40,G2<81,L2>40,L2<81),5,IF(AND(G2>80,L2>80),6,IF(AND(G2>41,G2<=81,L2>80),7,IF(AND(G2<41,L2>40,L2<81),8,IF(AND(G2<41,L2>80),9,IF(AND(G2>80,L2>40,L2<81),3,IF(AND(G2>40,G2<81,L2<41),2,IF(AND(G2>81,L2<41),1,0)))))))))
Note:
- I've done little modification and instead of
IF(AND(G2>41,G2>81,L2>80),7
I've written like this,
IF(AND(G2>41,G2<=81,L2>80),7
because the previous logic And(G2>80, L2>80)
for 6
was contradicting with IF(AND(G2>41,G2>81,L2>80),7
add a comment |
Your Formula should written like this:
=IF(AND(G2<41,L2<41),4,IF(AND(G2>40,G2<81,L2>40,L2<81),5,IF(AND(G2>80,L2>80),6,IF(AND(G2>41,G2<=81,L2>80),7,IF(AND(G2<41,L2>40,L2<81),8,IF(AND(G2<41,L2>80),9,IF(AND(G2>80,L2>40,L2<81),3,IF(AND(G2>40,G2<81,L2<41),2,IF(AND(G2>81,L2<41),1,0)))))))))
Note:
- I've done little modification and instead of
IF(AND(G2>41,G2>81,L2>80),7
I've written like this,
IF(AND(G2>41,G2<=81,L2>80),7
because the previous logic And(G2>80, L2>80)
for 6
was contradicting with IF(AND(G2>41,G2>81,L2>80),7
Your Formula should written like this:
=IF(AND(G2<41,L2<41),4,IF(AND(G2>40,G2<81,L2>40,L2<81),5,IF(AND(G2>80,L2>80),6,IF(AND(G2>41,G2<=81,L2>80),7,IF(AND(G2<41,L2>40,L2<81),8,IF(AND(G2<41,L2>80),9,IF(AND(G2>80,L2>40,L2<81),3,IF(AND(G2>40,G2<81,L2<41),2,IF(AND(G2>81,L2<41),1,0)))))))))
Note:
- I've done little modification and instead of
IF(AND(G2>41,G2>81,L2>80),7
I've written like this,
IF(AND(G2>41,G2<=81,L2>80),7
because the previous logic And(G2>80, L2>80)
for 6
was contradicting with IF(AND(G2>41,G2>81,L2>80),7
answered Mar 9 at 8:39
Rajesh SRajesh S
4,2832524
4,2832524
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- 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%2fsuperuser.com%2fquestions%2f1403888%2fif-and-combination-produces-youve-entered-too-many-arguments-for-this-function%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
present you set of input values of G and L as a normal table, without the formula, for easy understanding of what values should result in what output.
– VSRawat
Feb 9 at 15:08