Trouble using IFERROR with an IF statement that has Multiple Conditions
I have a nested IF formula. The return value for some of the IF statements is given by index-matching. If the item doesn't exist on the other sheet, the index-match returns a #N/A, but if there's an error I want the cell to say "Needs Investigation" instead of #N/A, so I've put in IFERROR statements to do this. This works fine. See the first IF statement I have emboldened to see what I'm talking about.
The issue I'm having is with the last IF statement (also in bold). This one is different from all the other because it has multiple conditions (one of which is given by index-matching) and because I specify an Else return value (i.e. If condition is true, then return value, else return other value). I want to achieve the same thing as above (that is, if the same #N/A error occurs as above I want the cell to say "Needs Investigation" instead of #N/A). I've put in IFERROR statements everywhere I can think of, and nothing works. Where should I be putting in IFERRORs? Or should I be using something other than IFERROR?
=IF(D2="Approved","Approved",IF((AND(D2="Supplier Submittal",E2="Interim Approval")),"Interim Approved",IF(D2="Define","Initial Review",IF(D2="Due Date Approval","Initial Review",IF(D2="Initial Review","Initial Review",IF(D2="No Status","Drawing Not Released",IF(D2="Polaris Review","Polaris Review",IF(D2="Staging","Waiting on Child Components",IF(D2="Supplier Acceptance","Initial Review",**IF(D2="Closed W/O Approval",IFERROR(INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)),"Needs Investigation")**, IF(D2="Needs Validation",IFERROR(INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)),"Needs Investigation"),IF(D2="No PPAP Required",IFERROR(INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)),"Needs Investigation"), IF(D2="Transferred",IFERROR(INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)),"Needs Investigation"),IF((AND(D2="Supplier Submittal",C2<TODAY())),"Supplier Late",IF((AND(D2="Supplier Submittal",C2>TODAY(),C2<$J$1)),"On Track for PV",**IF((AND(D2="Supplier Submittal",C2>$J$1, INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0))="")),"Due after PV",INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)))**)))))))))))))))
Here's the same formula, probably easier to look at.
If it helps, here's an example of the the first IF statement I emboldened (the one that works)
from the spreadsheet.
And here's a snapshot of an example of the IF statement I'm
having trouble with.
microsoft-excel worksheet-function microsoft-excel-2010 microsoft-excel-2007
add a comment |
I have a nested IF formula. The return value for some of the IF statements is given by index-matching. If the item doesn't exist on the other sheet, the index-match returns a #N/A, but if there's an error I want the cell to say "Needs Investigation" instead of #N/A, so I've put in IFERROR statements to do this. This works fine. See the first IF statement I have emboldened to see what I'm talking about.
The issue I'm having is with the last IF statement (also in bold). This one is different from all the other because it has multiple conditions (one of which is given by index-matching) and because I specify an Else return value (i.e. If condition is true, then return value, else return other value). I want to achieve the same thing as above (that is, if the same #N/A error occurs as above I want the cell to say "Needs Investigation" instead of #N/A). I've put in IFERROR statements everywhere I can think of, and nothing works. Where should I be putting in IFERRORs? Or should I be using something other than IFERROR?
=IF(D2="Approved","Approved",IF((AND(D2="Supplier Submittal",E2="Interim Approval")),"Interim Approved",IF(D2="Define","Initial Review",IF(D2="Due Date Approval","Initial Review",IF(D2="Initial Review","Initial Review",IF(D2="No Status","Drawing Not Released",IF(D2="Polaris Review","Polaris Review",IF(D2="Staging","Waiting on Child Components",IF(D2="Supplier Acceptance","Initial Review",**IF(D2="Closed W/O Approval",IFERROR(INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)),"Needs Investigation")**, IF(D2="Needs Validation",IFERROR(INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)),"Needs Investigation"),IF(D2="No PPAP Required",IFERROR(INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)),"Needs Investigation"), IF(D2="Transferred",IFERROR(INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)),"Needs Investigation"),IF((AND(D2="Supplier Submittal",C2<TODAY())),"Supplier Late",IF((AND(D2="Supplier Submittal",C2>TODAY(),C2<$J$1)),"On Track for PV",**IF((AND(D2="Supplier Submittal",C2>$J$1, INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0))="")),"Due after PV",INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)))**)))))))))))))))
Here's the same formula, probably easier to look at.
If it helps, here's an example of the the first IF statement I emboldened (the one that works)
from the spreadsheet.
And here's a snapshot of an example of the IF statement I'm
having trouble with.
microsoft-excel worksheet-function microsoft-excel-2010 microsoft-excel-2007
1
It looks like a bunch of what your formula does could be achieved with aVLOOKUP
or anINDEX/MATCH
. Do you have a table of the possible values ofD2
?
– cybernetic.nomad
Feb 14 at 19:30
There is also IFNA() available.
– Brian
Feb 14 at 19:47
add a comment |
I have a nested IF formula. The return value for some of the IF statements is given by index-matching. If the item doesn't exist on the other sheet, the index-match returns a #N/A, but if there's an error I want the cell to say "Needs Investigation" instead of #N/A, so I've put in IFERROR statements to do this. This works fine. See the first IF statement I have emboldened to see what I'm talking about.
The issue I'm having is with the last IF statement (also in bold). This one is different from all the other because it has multiple conditions (one of which is given by index-matching) and because I specify an Else return value (i.e. If condition is true, then return value, else return other value). I want to achieve the same thing as above (that is, if the same #N/A error occurs as above I want the cell to say "Needs Investigation" instead of #N/A). I've put in IFERROR statements everywhere I can think of, and nothing works. Where should I be putting in IFERRORs? Or should I be using something other than IFERROR?
=IF(D2="Approved","Approved",IF((AND(D2="Supplier Submittal",E2="Interim Approval")),"Interim Approved",IF(D2="Define","Initial Review",IF(D2="Due Date Approval","Initial Review",IF(D2="Initial Review","Initial Review",IF(D2="No Status","Drawing Not Released",IF(D2="Polaris Review","Polaris Review",IF(D2="Staging","Waiting on Child Components",IF(D2="Supplier Acceptance","Initial Review",**IF(D2="Closed W/O Approval",IFERROR(INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)),"Needs Investigation")**, IF(D2="Needs Validation",IFERROR(INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)),"Needs Investigation"),IF(D2="No PPAP Required",IFERROR(INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)),"Needs Investigation"), IF(D2="Transferred",IFERROR(INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)),"Needs Investigation"),IF((AND(D2="Supplier Submittal",C2<TODAY())),"Supplier Late",IF((AND(D2="Supplier Submittal",C2>TODAY(),C2<$J$1)),"On Track for PV",**IF((AND(D2="Supplier Submittal",C2>$J$1, INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0))="")),"Due after PV",INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)))**)))))))))))))))
Here's the same formula, probably easier to look at.
If it helps, here's an example of the the first IF statement I emboldened (the one that works)
from the spreadsheet.
And here's a snapshot of an example of the IF statement I'm
having trouble with.
microsoft-excel worksheet-function microsoft-excel-2010 microsoft-excel-2007
I have a nested IF formula. The return value for some of the IF statements is given by index-matching. If the item doesn't exist on the other sheet, the index-match returns a #N/A, but if there's an error I want the cell to say "Needs Investigation" instead of #N/A, so I've put in IFERROR statements to do this. This works fine. See the first IF statement I have emboldened to see what I'm talking about.
The issue I'm having is with the last IF statement (also in bold). This one is different from all the other because it has multiple conditions (one of which is given by index-matching) and because I specify an Else return value (i.e. If condition is true, then return value, else return other value). I want to achieve the same thing as above (that is, if the same #N/A error occurs as above I want the cell to say "Needs Investigation" instead of #N/A). I've put in IFERROR statements everywhere I can think of, and nothing works. Where should I be putting in IFERRORs? Or should I be using something other than IFERROR?
=IF(D2="Approved","Approved",IF((AND(D2="Supplier Submittal",E2="Interim Approval")),"Interim Approved",IF(D2="Define","Initial Review",IF(D2="Due Date Approval","Initial Review",IF(D2="Initial Review","Initial Review",IF(D2="No Status","Drawing Not Released",IF(D2="Polaris Review","Polaris Review",IF(D2="Staging","Waiting on Child Components",IF(D2="Supplier Acceptance","Initial Review",**IF(D2="Closed W/O Approval",IFERROR(INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)),"Needs Investigation")**, IF(D2="Needs Validation",IFERROR(INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)),"Needs Investigation"),IF(D2="No PPAP Required",IFERROR(INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)),"Needs Investigation"), IF(D2="Transferred",IFERROR(INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)),"Needs Investigation"),IF((AND(D2="Supplier Submittal",C2<TODAY())),"Supplier Late",IF((AND(D2="Supplier Submittal",C2>TODAY(),C2<$J$1)),"On Track for PV",**IF((AND(D2="Supplier Submittal",C2>$J$1, INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0))="")),"Due after PV",INDEX(SharePoint!X:X,MATCH('Exceptions List'!A2,SharePoint!N:N,0)))**)))))))))))))))
Here's the same formula, probably easier to look at.
If it helps, here's an example of the the first IF statement I emboldened (the one that works)
from the spreadsheet.
And here's a snapshot of an example of the IF statement I'm
having trouble with.
microsoft-excel worksheet-function microsoft-excel-2010 microsoft-excel-2007
microsoft-excel worksheet-function microsoft-excel-2010 microsoft-excel-2007
edited Feb 14 at 19:11
forlorn
asked Feb 14 at 19:03
forlornforlorn
103
103
1
It looks like a bunch of what your formula does could be achieved with aVLOOKUP
or anINDEX/MATCH
. Do you have a table of the possible values ofD2
?
– cybernetic.nomad
Feb 14 at 19:30
There is also IFNA() available.
– Brian
Feb 14 at 19:47
add a comment |
1
It looks like a bunch of what your formula does could be achieved with aVLOOKUP
or anINDEX/MATCH
. Do you have a table of the possible values ofD2
?
– cybernetic.nomad
Feb 14 at 19:30
There is also IFNA() available.
– Brian
Feb 14 at 19:47
1
1
It looks like a bunch of what your formula does could be achieved with a
VLOOKUP
or an INDEX/MATCH
. Do you have a table of the possible values of D2
?– cybernetic.nomad
Feb 14 at 19:30
It looks like a bunch of what your formula does could be achieved with a
VLOOKUP
or an INDEX/MATCH
. Do you have a table of the possible values of D2
?– cybernetic.nomad
Feb 14 at 19:30
There is also IFNA() available.
– Brian
Feb 14 at 19:47
There is also IFNA() available.
– Brian
Feb 14 at 19:47
add a comment |
1 Answer
1
active
oldest
votes
Using the SWITCH
function may help in debugging the issue by making the formula more readable and easier to maintain. The parentheses have been reduced by 15 sets including the outer sets surrounding the (
AND(...)
)
functions.
Because there is still IF
nesting in the "Supplier Submittal" case requiring a default action (the last nested IF
's FALSE
condition), this default was also duplicated to the SWITCH
function's default clause. These defaults INDEX(MATCH())
are now bracketed by IFERROR
. The lack of IFERROR
here likely caused the #N/A error.
The potential for an uncaught #N/A error in the INDEX(MATCH())=""
test to determine a "Due after PV" condition could be fixed locally by returning something other than ""
like this AND( C2>$J$1,
IFERROR(
INDEX(MATCH())
,"NO MATCH")
=""), "Due after PV",
. Having this IFERROR
return "Needs Investigation" would also make the comparison to ""
FALSE
causing this final IF
's FALSE
condition, IFERROR(INDEX(MATCH()),...
to return "Needs Investigation".
The implemented solution was to bracket this entire final nested IF
("Due after PV") in the IFERROR
and removing the redundant IFERROR
from this IF
's FALSE
condition.
Occasionally Excel likes to paste multi-line formulas into multiple cells. In this case, paste the formula directly into the formula bar.
The formula (bar) can be formatted with line breaks by pressing Alt-Enter
=SWITCH(D2,
"Approved", "Approved",
"Define", "Initial Review",
"Due Date Approval", "Initial Review",
"Initial Review", "Initial Review",
"No Status", "Drawing Not Released",
"Polaris Review", "Polaris Review",
"Staging", "Waiting on Child Components",
"Supplier Acceptance", "Initial Review",
"Closed W/O Approval",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"Needs Validation",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"No PPAP Required",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"Transferred",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"Supplier Submittal",
IF( E2 = "Interim Approval", "Interim Approved",
IF( C2 < TODAY(), "Supplier Late",
IF( AND( C2 > TODAY(), C2 < $J$1 ), "On Track for PV",
IFERROR( IF( AND( C2> $J$1, INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)) = ""), "Due after PV",
INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0))), "Needs Investigation")
))),
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"))
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%2f1405807%2ftrouble-using-iferror-with-an-if-statement-that-has-multiple-conditions%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Using the SWITCH
function may help in debugging the issue by making the formula more readable and easier to maintain. The parentheses have been reduced by 15 sets including the outer sets surrounding the (
AND(...)
)
functions.
Because there is still IF
nesting in the "Supplier Submittal" case requiring a default action (the last nested IF
's FALSE
condition), this default was also duplicated to the SWITCH
function's default clause. These defaults INDEX(MATCH())
are now bracketed by IFERROR
. The lack of IFERROR
here likely caused the #N/A error.
The potential for an uncaught #N/A error in the INDEX(MATCH())=""
test to determine a "Due after PV" condition could be fixed locally by returning something other than ""
like this AND( C2>$J$1,
IFERROR(
INDEX(MATCH())
,"NO MATCH")
=""), "Due after PV",
. Having this IFERROR
return "Needs Investigation" would also make the comparison to ""
FALSE
causing this final IF
's FALSE
condition, IFERROR(INDEX(MATCH()),...
to return "Needs Investigation".
The implemented solution was to bracket this entire final nested IF
("Due after PV") in the IFERROR
and removing the redundant IFERROR
from this IF
's FALSE
condition.
Occasionally Excel likes to paste multi-line formulas into multiple cells. In this case, paste the formula directly into the formula bar.
The formula (bar) can be formatted with line breaks by pressing Alt-Enter
=SWITCH(D2,
"Approved", "Approved",
"Define", "Initial Review",
"Due Date Approval", "Initial Review",
"Initial Review", "Initial Review",
"No Status", "Drawing Not Released",
"Polaris Review", "Polaris Review",
"Staging", "Waiting on Child Components",
"Supplier Acceptance", "Initial Review",
"Closed W/O Approval",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"Needs Validation",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"No PPAP Required",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"Transferred",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"Supplier Submittal",
IF( E2 = "Interim Approval", "Interim Approved",
IF( C2 < TODAY(), "Supplier Late",
IF( AND( C2 > TODAY(), C2 < $J$1 ), "On Track for PV",
IFERROR( IF( AND( C2> $J$1, INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)) = ""), "Due after PV",
INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0))), "Needs Investigation")
))),
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"))
add a comment |
Using the SWITCH
function may help in debugging the issue by making the formula more readable and easier to maintain. The parentheses have been reduced by 15 sets including the outer sets surrounding the (
AND(...)
)
functions.
Because there is still IF
nesting in the "Supplier Submittal" case requiring a default action (the last nested IF
's FALSE
condition), this default was also duplicated to the SWITCH
function's default clause. These defaults INDEX(MATCH())
are now bracketed by IFERROR
. The lack of IFERROR
here likely caused the #N/A error.
The potential for an uncaught #N/A error in the INDEX(MATCH())=""
test to determine a "Due after PV" condition could be fixed locally by returning something other than ""
like this AND( C2>$J$1,
IFERROR(
INDEX(MATCH())
,"NO MATCH")
=""), "Due after PV",
. Having this IFERROR
return "Needs Investigation" would also make the comparison to ""
FALSE
causing this final IF
's FALSE
condition, IFERROR(INDEX(MATCH()),...
to return "Needs Investigation".
The implemented solution was to bracket this entire final nested IF
("Due after PV") in the IFERROR
and removing the redundant IFERROR
from this IF
's FALSE
condition.
Occasionally Excel likes to paste multi-line formulas into multiple cells. In this case, paste the formula directly into the formula bar.
The formula (bar) can be formatted with line breaks by pressing Alt-Enter
=SWITCH(D2,
"Approved", "Approved",
"Define", "Initial Review",
"Due Date Approval", "Initial Review",
"Initial Review", "Initial Review",
"No Status", "Drawing Not Released",
"Polaris Review", "Polaris Review",
"Staging", "Waiting on Child Components",
"Supplier Acceptance", "Initial Review",
"Closed W/O Approval",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"Needs Validation",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"No PPAP Required",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"Transferred",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"Supplier Submittal",
IF( E2 = "Interim Approval", "Interim Approved",
IF( C2 < TODAY(), "Supplier Late",
IF( AND( C2 > TODAY(), C2 < $J$1 ), "On Track for PV",
IFERROR( IF( AND( C2> $J$1, INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)) = ""), "Due after PV",
INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0))), "Needs Investigation")
))),
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"))
add a comment |
Using the SWITCH
function may help in debugging the issue by making the formula more readable and easier to maintain. The parentheses have been reduced by 15 sets including the outer sets surrounding the (
AND(...)
)
functions.
Because there is still IF
nesting in the "Supplier Submittal" case requiring a default action (the last nested IF
's FALSE
condition), this default was also duplicated to the SWITCH
function's default clause. These defaults INDEX(MATCH())
are now bracketed by IFERROR
. The lack of IFERROR
here likely caused the #N/A error.
The potential for an uncaught #N/A error in the INDEX(MATCH())=""
test to determine a "Due after PV" condition could be fixed locally by returning something other than ""
like this AND( C2>$J$1,
IFERROR(
INDEX(MATCH())
,"NO MATCH")
=""), "Due after PV",
. Having this IFERROR
return "Needs Investigation" would also make the comparison to ""
FALSE
causing this final IF
's FALSE
condition, IFERROR(INDEX(MATCH()),...
to return "Needs Investigation".
The implemented solution was to bracket this entire final nested IF
("Due after PV") in the IFERROR
and removing the redundant IFERROR
from this IF
's FALSE
condition.
Occasionally Excel likes to paste multi-line formulas into multiple cells. In this case, paste the formula directly into the formula bar.
The formula (bar) can be formatted with line breaks by pressing Alt-Enter
=SWITCH(D2,
"Approved", "Approved",
"Define", "Initial Review",
"Due Date Approval", "Initial Review",
"Initial Review", "Initial Review",
"No Status", "Drawing Not Released",
"Polaris Review", "Polaris Review",
"Staging", "Waiting on Child Components",
"Supplier Acceptance", "Initial Review",
"Closed W/O Approval",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"Needs Validation",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"No PPAP Required",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"Transferred",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"Supplier Submittal",
IF( E2 = "Interim Approval", "Interim Approved",
IF( C2 < TODAY(), "Supplier Late",
IF( AND( C2 > TODAY(), C2 < $J$1 ), "On Track for PV",
IFERROR( IF( AND( C2> $J$1, INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)) = ""), "Due after PV",
INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0))), "Needs Investigation")
))),
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"))
Using the SWITCH
function may help in debugging the issue by making the formula more readable and easier to maintain. The parentheses have been reduced by 15 sets including the outer sets surrounding the (
AND(...)
)
functions.
Because there is still IF
nesting in the "Supplier Submittal" case requiring a default action (the last nested IF
's FALSE
condition), this default was also duplicated to the SWITCH
function's default clause. These defaults INDEX(MATCH())
are now bracketed by IFERROR
. The lack of IFERROR
here likely caused the #N/A error.
The potential for an uncaught #N/A error in the INDEX(MATCH())=""
test to determine a "Due after PV" condition could be fixed locally by returning something other than ""
like this AND( C2>$J$1,
IFERROR(
INDEX(MATCH())
,"NO MATCH")
=""), "Due after PV",
. Having this IFERROR
return "Needs Investigation" would also make the comparison to ""
FALSE
causing this final IF
's FALSE
condition, IFERROR(INDEX(MATCH()),...
to return "Needs Investigation".
The implemented solution was to bracket this entire final nested IF
("Due after PV") in the IFERROR
and removing the redundant IFERROR
from this IF
's FALSE
condition.
Occasionally Excel likes to paste multi-line formulas into multiple cells. In this case, paste the formula directly into the formula bar.
The formula (bar) can be formatted with line breaks by pressing Alt-Enter
=SWITCH(D2,
"Approved", "Approved",
"Define", "Initial Review",
"Due Date Approval", "Initial Review",
"Initial Review", "Initial Review",
"No Status", "Drawing Not Released",
"Polaris Review", "Polaris Review",
"Staging", "Waiting on Child Components",
"Supplier Acceptance", "Initial Review",
"Closed W/O Approval",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"Needs Validation",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"No PPAP Required",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"Transferred",
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"),
"Supplier Submittal",
IF( E2 = "Interim Approval", "Interim Approved",
IF( C2 < TODAY(), "Supplier Late",
IF( AND( C2 > TODAY(), C2 < $J$1 ), "On Track for PV",
IFERROR( IF( AND( C2> $J$1, INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)) = ""), "Due after PV",
INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0))), "Needs Investigation")
))),
IFERROR( INDEX( SharePoint!X:X, MATCH( 'Exceptions List'!A2, SharePoint!N:N, 0)), "Needs Investigation"))
answered Feb 15 at 1:11
Ted D.Ted D.
70528
70528
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%2f1405807%2ftrouble-using-iferror-with-an-if-statement-that-has-multiple-conditions%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
1
It looks like a bunch of what your formula does could be achieved with a
VLOOKUP
or anINDEX/MATCH
. Do you have a table of the possible values ofD2
?– cybernetic.nomad
Feb 14 at 19:30
There is also IFNA() available.
– Brian
Feb 14 at 19:47