我遇到以下问题。我有一个电子表格,可以获取SEC数据并将其解析为财务指标供我评估。然而,我是一个非常糟糕的程序员,我真的不确定我在这里做错了什么。我继续在ElseIf lngIteratorPhi = 271
处获得以下区块中没有If错误的Else。如果有帮助,我已经包含了前面和后面的块。对不起,如果我遗漏了一些明显的东西,我的大脑会在VBA for Applications中融化。
ElseIf lngIteratorPhi = 270 Then 'dcf calculator EPS
dblAverageFCFGrowthRateOverPast10Years = dblMinGrowthRate
If IsError(Sheets("Workout").Cells(1 + lngIteratorAlpha, 105).Value) = False _
And IsEmpty(Sheets("Workout").Cells(1 + lngIteratorAlpha, 105).Value) = False _
And Sheets("Workout").Cells(1 + lngIteratorAlpha, 105).Value <> 0 Then
dblAverageFCFGrowthRateOverPast10Years = Sheets("Workout").Cells(1 + lngIteratorAlpha, 105).Value / 100
Else
dblAverageFCFGrowthRateOverPast10Years = dblMinGrowthRate
End If
If dblAverageFCFGrowthRateOverPast10Years >= 0.2 Then
dblAverageFCFGrowthRateOverPast10Years = dblMaxGrowthRate
ElseIf dblAverageEarningsGrowthRateOverPast10Years <= 0.05 Then
dblAverageFCFGrowthRateOverPast10Years = dblMinGrowthRate
Else
dblAverageFCFGrowthRateOverPast10Years = dblMinGrowthRate
End If
dblAverageFCFGrowthRateOverPast10Years = dblGrowthRateInGrowthStage
If IsError(Sheets("Workout").Cells(1 + lngIteratorAlpha, 260).Value) = False _
And IsEmpty(Sheets("Workout").Cells(1 + lngIteratorAlpha, 260).Value) = False _
And Sheets("Workout").Cells(1 + lngIteratorAlpha, 260).Value <> 0 Then
dblFCF = Sheets("Workout").Cells(1 + lngIteratorAlpha, 260).Value
End If
strGrowthPeriodCalcEqTemp = ""
strTerminalPeriodCalcEqTemp = ""
For n = 1 To intYearsOfGrowthStage
strGrowthPeriodCalcEqTemp = "((1 + " & dblGrowthRateInGrowthStage & ")^" & n & "/ (1 +" & dblDiscountRate & ")^" & n & ") +"
strGrowthPeriodCalcEq = strGrowthPeriodCalcEq & strGrowthPeriodCalcEqTemp
If n = intYearsOfGrowthStage Then
strGrowthPeriodCalcEq = Left(strGrowthPeriodCalcEq, Len(strGrowthPeriodCalcEq) - 2)
strGrowthPeriodCalcEq = strGrowthPeriodCalcEq & ")"
End If
Next n
dblGrowthPeriodCalc = Eval(strGrowthPeriodCalcEq)
For n = 1 To intYearsOfTerminalGrowth
strTerminalPeriodCalcEqTemp = "((1 + " & dblTerminalGrowthRate & ")^" & n & "/ (1 +" & dblDiscountRate & ")^" & n & ") +"
strTerminalPeriodCalcEq = strTerminalPeriodCalcEq & strTerminalPeriodCalcEqTemp
If n = intYearsOfTerminalGrowth Then
strTerminalPeriodCalcEq = Left(strTerminalPeriodCalcEq, Len(strTerminalPeriodCalcEq) - 2)
strTerminalPeriodCalcEq = strTerminalPeriodCalcEq & ")"
End If
Next n
dblTerminalPeriodCalc = Eval(strTerminalPeriodCalcEq)
dblDCFFCF = dblFCF * (dblGrowthPeriodCalc + dblTerminalPeriodCalc)
With Sheets("Workout").Cells(1 + lngIteratorAlpha, 0 + lngIteratorPhi)
.NumberFormat = "$???,??0.00;[red]-$???,??0.00;$???,??0.00" ' currency for under 100,000 dollars
End With
Else
With Sheets("Workout").Cells(1 + lngIteratorAlpha, 0 + lngIteratorPhi)
.Value = "NULL"
End With
ElseIf lngIteratorPhi = 271 Then 'dcf calculator EPS
dblAverageEarningsGrowthRateOverPast10Years = dblMinGrowthRate
If IsError(Sheets("Workout").Cells(1 + lngIteratorAlpha, 98).Value) = False _
And IsEmpty(Sheets("Workout").Cells(1 + lngIteratorAlpha, 98).Value) = False _
And Sheets("Workout").Cells(1 + lngIteratorAlpha, 98).Value <> 0 Then
dblAverageEarningsGrowthRateOverPast10Years = Sheets("Workout").Cells(1 + lngIteratorAlpha, 98).Value / 100
End If
If dblAverageEarningsGrowthRateOverPast10Years >= 0.2 Then
dblAverageEarningsGrowthRateOverPast10Years = dblMaxGrowthRate
ElseIf dblAverageEarningsGrowthRateOverPast10Years <= 0.05 Then
dblAverageEarningsGrowthRateOverPast10Years = dblMinGrowthRate
End If
dblAverageEarningsGrowthRateOverPast10Years = dblGrowthRateInGrowthStage
If IsError(Sheets("Workout").Cells(1 + lngIteratorAlpha, 11).Value) = False _
And IsEmpty(Sheets("Workout").Cells(1 + lngIteratorAlpha, 11).Value) = False _
And Sheets("Workout").Cells(1 + lngIteratorAlpha, 11).Value <> 0 Then
dblEPS = Sheets("Workout").Cells(1 + lngIteratorAlpha, 11).Value
End If
For n = 1 To intYearsOfGrowthStage
strGrowthPeriodCalcEqTemp = ""
strGrowthPeriodCalcEqTemp = "((1 + " & dblGrowthRateInGrowthStage & ")^" & n & "/ (1 +" & dblDiscountRate & ")^" & n & ") +"
strGrowthPeriodCalcEq = strGrowthPeriodCalcEq & strGrowthPeriodCalcEqTemp
If n = intYearsOfGrowthStage Then
strGrowthPeriodCalcEq = Left(strGrowthPeriodCalcEq, Len(strGrowthPeriodCalcEq) - 2)
strGrowthPeriodCalcEq = strGrowthPeriodCalcEq & ")"
End If
Next n
dblGrowthPeriodCalc = Eval(strGrowthPeriodCalcEq)
For n = 1 To intYearsOfTerminalGrowth
strTerminalPeriodCalcEqTemp = ""
strTerminalPeriodCalcEqTemp = "((1 + " & dblTerminalGrowthRate & ")^" & n & "/ (1 +" & dblDiscountRate & ")^" & n & ") +"
strTerminalPeriodCalcEq = strTerminalPeriodCalcEq & strTerminalPeriodCalcEqTemp
If n = intYearsOfTerminalGrowth Then
strTerminalPeriodCalcEq = Left(strTerminalPeriodCalcEq, Len(strTerminalPeriodCalcEq) - 2)
strTerminalPeriodCalcEq = strTerminalPeriodCalcEq & ")"
End If
Next n
dblTerminalPeriodCalc = Eval(strTerminalPeriodCalcEq)
dblDCFEPS = dblEPS * (dblGrowthPeriodCalc + dblTerminalPeriodCalc)
With Sheets("Workout").Cells(1 + lngIteratorAlpha, 0 + lngIteratorPhi)
.NumberFormat = "$???,??0.00;[red]-$???,??0.00;$???,??0.00" ' currency for under 100,000 dollars
End With
Else
With Sheets("Workout").Cells(1 + lngIteratorAlpha, 0 + lngIteratorPhi)
.Value = "NULL"
End With
ElseIf lngIteratorPhi = 273 Then
If IsError(Sheets("Workout").Cells(1 + lngIteratorAlpha, 270).Value) = False _
And IsEmpty(Sheets("Workout").Cells(1 + lngIteratorAlpha, 270).Value) = False _
And Sheets("Workout").Cells(1 + lngIteratorAlpha, 270).Value <> 0 Then
With Sheets("Workout").Cells(1 + lngIteratorAlpha, 0 + lngIteratorPhi)
.Value = Sheets("Workout").Cells(1 + lngIteratorAlpha, 270).Value * 0.85
.NumberFormat = "$???,??0.00;[red]-$???,??0.00;$???,??0.00" ' currency for under 100,000 dollars
End With
Else
With Sheets("Workout").Cells(1 + lngIteratorAlpha, 0 + lngIteratorPhi)
.Value = "NULL"
End With
End If
答案 0 :(得分:0)
哦,我现在看到我最后还有一个额外的Else。标记为已解决!