ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Nested IF error (https://www.excelbanter.com/excel-worksheet-functions/136745-nested-if-error.html)

KD

Nested IF error
 
Any suggestion on this would be greatly appreciated.
I am getting an error while running this formula, can't figure out where am
I missing.

=if(L2="I",if(L2="R","B",IF(L2="F","Ro",if(L2="SCA ","Ri",if(or(S2="IA",N2="GBS"),"GN",if(AND(L2="HC" ,or(N2="Fi",N2="In",N2="XC")),"OM",if(OR(N2="Ex",S 2<"IA"),N2="COS",N2="CO",S2="L"),"D","W")))))))

Thanks.
KD

Pete_UK

Nested IF error
 
I think the formula has suffered from line-wrap on the newsgroups, and
this sometimes inserts hyphens where they are not needed - where you
have

N2="Ex",S-

at the end of the second line and it then continues the next line with

2<"IA"),

these should be combined without a hyphen between them, like so

N2="Ex",S2<"IA"),

and so on.

Hope this helps.

Pete


On Mar 28, 1:00 am, Greg Wilson
wrote:
With credit to bj in his/her response to your post in the worksheet functions
ng, if you remove the ")" following the "IA" it becomes structurally correct
and looks sensible to me. But I suspect this is still not what you intended.

We don't know how your worksheet is layed out and what you are trying to
achieve. You need to specify it. It's not just a simple "fix what's broken"
issue. It's a design flaw and there's more than one way to redesign it.

Note that your first (parent) IF function has only two arguments. This is
still syntactically correct because the third is optional. The formula in
this case will return FALSE by default.

FWIW, pseudo VBA code that translates the syntactically correct part of your
formula follows. Perhaps this logic structure or something along this line
could be used to spell out what you want:

If L2 = "I" Then
If L2 = "R" Then
Return "B"
ElseIf L2 = "F" Then
Return "Ro"
ElseIf L2 = "SCA" Then
Return "Ri"
ElseIf Or(S2 = "IA", N2 = "GBS") Then
Return "GN"
ElseIf AND(L2 = "HC", OR(N2 = "Fi", N2 = "In", N2 = "XC") Then
Return "OM"
<<<<<<< syntactically incorrect beyond here
End IF
End If

Regards,
Greg



"kd" wrote:
Any suggestion on this would be greatly appreciated.
I am getting an error while running this formula, can't figure out where am
I missing.


=if(L2="I",if(L2="R","B",IF(L2="F","Ro",if(L2="SCA ","Ri",if(or(S2="IA",N2="*GBS"),"GN",if(AND(L2="HC ",or(N2="Fi",N2="In",N2="XC")),"OM",if(OR(N2="Ex", S*2<"IA"),N2="COS",N2="CO",S2="L"),"D","W")))))))


Thanks.
KD- Hide quoted text -


- Show quoted text -




bj

Nested IF error
 
you are missing the true responce for the initial "L2="I"" statement
and in the the last if statement, you may need another "and" or "or" in the
logical statement or you may need to get rid of the ")" after "IA"

"kd" wrote:

Any suggestion on this would be greatly appreciated.
I am getting an error while running this formula, can't figure out where am
I missing.

=if(L2="I",if(L2="R","B",IF(L2="F","Ro",if(L2="SCA ","Ri",if(or(S2="IA",N2="GBS"),"GN",if(AND(L2="HC" ,or(N2="Fi",N2="In",N2="XC")),"OM",if(OR(N2="Ex",S 2<"IA"),N2="COS",N2="CO",S2="L"),"D","W")))))))

Thanks.
KD


John

Nested IF error
 
I think you have one too many closed brackets ')' and you are going over the
limit of 7 nested functions

--
John
MOS Master Instructor Office 2000, 2002 & 2003
Please reply & rate any replies you get

Ice Hockey rules (especially the Wightlink Raiders)


"kd" wrote:

Any suggestion on this would be greatly appreciated.
I am getting an error while running this formula, can't figure out where am
I missing.

=if(L2="I",if(L2="R","B",IF(L2="F","Ro",if(L2="SCA ","Ri",if(or(S2="IA",N2="GBS"),"GN",if(AND(L2="HC" ,or(N2="Fi",N2="In",N2="XC")),"OM",if(OR(N2="Ex",S 2<"IA"),N2="COS",N2="CO",S2="L"),"D","W")))))))

Thanks.
KD



All times are GMT +1. The time now is 03:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com