alexlus
02-01-2015, 10:00 AM
Hello,
I'm new to the forum as well as creating functions in excels or any VBA.
I have this set of equations that I want to get a final value based on some If statements. The final value Qr is the output based on variables Pr, Pbh, Ql, Pbp that will be in separate cells.
IF Pr <= Pbp
Qm = Ql / ( 1 - 0.2 * ( Pbh / Pr ) - 0.8 * ( Pbh / Pr ) ^ 2 )
Qr = Qm * ( 1 - 0.2 * ( Pbh / Pr ) - 0.8 * ( Pbh / Pr ) ^2)
ELSE
IF Pbh >= Pbp
J = Ql / ( Pr - Pbh )
ELSE
J = Ql / ( ( Pr - Pbp ) + ( Pbp / 1.8 ) * ( 1 - 0.2 * ( Pbh / Pbp ) - 0.8 * ( Pbh / Pbp ) ^ 2 )
Qbp = J * ( Pr - Pbp )
IF Pbh >= Pbp
Qr = J * ( Pr - Pbh )
ELSE
Qr = Qbp + ( J * ( Pbp / 1.8 ) * ( 1 - 0.2 * ( Pbh / Pbp ) - 0.8 * ( Pbh / Pbp ) ^ 2)
Any help is would be very appreciated.
Thank you.
I'm new to the forum as well as creating functions in excels or any VBA.
I have this set of equations that I want to get a final value based on some If statements. The final value Qr is the output based on variables Pr, Pbh, Ql, Pbp that will be in separate cells.
IF Pr <= Pbp
Qm = Ql / ( 1 - 0.2 * ( Pbh / Pr ) - 0.8 * ( Pbh / Pr ) ^ 2 )
Qr = Qm * ( 1 - 0.2 * ( Pbh / Pr ) - 0.8 * ( Pbh / Pr ) ^2)
ELSE
IF Pbh >= Pbp
J = Ql / ( Pr - Pbh )
ELSE
J = Ql / ( ( Pr - Pbp ) + ( Pbp / 1.8 ) * ( 1 - 0.2 * ( Pbh / Pbp ) - 0.8 * ( Pbh / Pbp ) ^ 2 )
Qbp = J * ( Pr - Pbp )
IF Pbh >= Pbp
Qr = J * ( Pr - Pbh )
ELSE
Qr = Qbp + ( J * ( Pbp / 1.8 ) * ( 1 - 0.2 * ( Pbh / Pbp ) - 0.8 * ( Pbh / Pbp ) ^ 2)
Any help is would be very appreciated.
Thank you.