LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rod Rod is offline
external usenet poster
 
Posts: 108
Default #NAME? error in nested if & VB

I have many cellse (5 x 10) usine up to 6 nested ifs in each cell. a cell
looks similar to:

=IF(AND(ISNUMBER(Summary_GOOD),AB40),CompDM($D40," GOOD",Summary_GOOD)-IF(AB39,CompDM($D39,"GOOD",Summary_GOOD),IF(AB38,C ompDM($D38,"GOOD",Summary_GOOD),IF(AB37,CompDM($D3 7,"GOOD",Summary_GOOD),IF(AB36,CompDM($D36,"GOOD", Summary_GOOD),IF(Summary_GOOD_Writer="REP",CompDM( "REP","GOOD",Summary_GOOD),0))))))

In an attempt to reduce the size of the formula I created in VB (1st attempt
at VB:

Function CompDM(Contract_Level As String, Product As String, Loan_Amount As
Single) As Single
Dim ContractPercent As Single

ComDM = 0
Select Case Product
Case "SMART", "Smart", "smart"
Select Case Contract_Level
Case "Rep", "REP", "rep"
ContractPercent = 0.0031
Case "SRep", "SREP", "srep", "Srep"
ContractPercent = 0.0036
Case "Dis", "DIS", "dis"
ContractPercent = 0.0044
Case "Div", "DIV", "div"
ContractPercent = 0.0057
Case "Reg", "REG", "reg"
ContractPercent = 0.0083
Case "SReg", "SREG", "sreg", "Sreg"
ContractPercent = 0.0083
Case "RVP", "rvp", "Rvp"
ContractPercent = 0.0123
End Select
Case "GOOD", "good", "Good"
Select Case Contract_Level
Case "Rep", "REP", "rep"
ContractPercent = 0.0031
Case "SRep", "SREP", "srep", "Srep"
ContractPercent = 0.0036
Case "Dis", "DIS", "dis"
ContractPercent = 0.0044
Case "Div", "DIV", "div"
ContractPercent = 0.0057
Case "Reg", "REG", "reg"
ContractPercent = 0.0083
Case "SReg", "SREG", "sreg", "Sreg"
ContractPercent = 0.0083
Case "RVP", "rvp", "Rvp"
ContractPercent = 0.0125
End Select
End Select
CompDM = Loan_Amount * ContractPercent
End Function

Cell Values:
D36 through D40:
SREP
DIS
DIV
REG
RVP

Summary_Good = 100000
Summary_GOOD_Writer = "DIV"

AB38 = FALSE
AB39 = FALSE
AB40 = FALSE
AB41 = FALSE
AB41 = TRUE
AB42 = TRUE

The value for the last If statement comes back
Logical_test: "= FALSE"
Value_if_true: "= 310"
Value_if_false: "= 0"
Result of function: "=0"
The value for the second to the last if comes back:
Logical_test: "= FALSE"
Value_if_true: "= 360"
Value_if_false: "=0
Result of function: "=" (there is nothing shown)
The value for the third to the last if comes back:
Logical_test = FALSE
Value_if_true "= 440"
Value_if_false "= #NAME?"
Result for the function " = " (nothing is shown)

How can I resolve this? The #NAME? continues in the Value_if_false and the
function results are blank in the 4th & 5th to the last statments. the very
first if statment:
Logical_test: "= TRUE"
Value_if_tru: "= #NAME?"
Value_if_false: "= any" (grayed out)
Result of function: "=" (nothing shows)

However, the cell holding this forluma (K40) results in 420. So, it looks
like part of the problem is the resulting "NAME?" but the root problem is
what is causing this and how can I fix it?

Thx VERY MUCh for your help!!!
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nested IF error kd Excel Worksheet Functions 3 March 28th 07 02:44 AM
Nested IF error Greg Wilson Excel Worksheet Functions 0 March 28th 07 01:00 AM
Nested IF error Mike Excel Discussion (Misc queries) 0 March 28th 07 12:07 AM
3 nested IFs causes error Bob Excel Worksheet Functions 6 January 29th 07 07:43 PM
Nested IF error Ricardo Monteiro :^) Excel Worksheet Functions 10 February 5th 06 08:40 PM


All times are GMT +1. The time now is 06:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"