I'm receiving a #VALUE error when I attempt to run the following function on my worksheet. Specifically, I am told that "a value used in the formula is of the wrong data type"
both the ubeta unlever and relever fuctions that I call internally in this function run just fine on their own so I don't think the issue is with them.
Does anyone know what might be causing this error to occur? I've been staring at it for about an hour and can't seem to figure it out (bear with me I'm new)
Thanks
Chris
Function WACC(cbeta As Double, CDebtAsset As Double, ODebtAsset As Double, m As Double, rf As Double, CostOfDebt As Double, CorpTax As Double)
Dim ubeta As Double
Dim WACCbeta As Double
Dim re As Double
ubeta = Application.unlever(cbeta, CorpTax, CDebtAsset)
WACCbeta = Application.Relever(ubeta, CorpTax, ODebtAsset)
re = rf + WACCbeta * (m - rf)
WACC = ((1 - ODebtAsset) * re) + (ODebtAsset * CostOfDebt * (1 - CorpTax))
End Function
both the ubeta unlever and relever fuctions that I call internally in this function run just fine on their own so I don't think the issue is with them.
Does anyone know what might be causing this error to occur? I've been staring at it for about an hour and can't seem to figure it out (bear with me I'm new)
Thanks
Chris
Function WACC(cbeta As Double, CDebtAsset As Double, ODebtAsset As Double, m As Double, rf As Double, CostOfDebt As Double, CorpTax As Double)
Dim ubeta As Double
Dim WACCbeta As Double
Dim re As Double
ubeta = Application.unlever(cbeta, CorpTax, CDebtAsset)
WACCbeta = Application.Relever(ubeta, CorpTax, ODebtAsset)
re = rf + WACCbeta * (m - rf)
WACC = ((1 - ODebtAsset) * re) + (ODebtAsset * CostOfDebt * (1 - CorpTax))
End Function