Hello,
I'm new to Excel and trying to figure out how to define my own function. I'm getting a circular reference error when I try to run my function, but I can't see any problem with the code. Any help would be very much appreciated! Thanks! Here is the code:
----------------------------------
Option Explicit
Function MELT(S As Double, albedo As Double, beta As Double, D As Double)
Dim A As Double
Dim B As Double
Dim T As Double
Dim sigma As Double
Dim L As Double
Dim dt As Double
sigma = 5.67 * (10 ^ -8) 'stefan boltzmann constant (W m^-2 K^-4)
T = 273.15 'surface temperature of ice during melt season (K)
A = -3 * sigma * T ^ 4 'blackbody radiation constant (W m^-2)
B = 4 * sigma * T ^ 3 'blackbody radiation constant (W m^-2 K^-1)
L = 3 * 10 ^ 8 'Latent heat of fusion (J m^-3)
dt = 60 * 60 * 24 * 31 * 3 'length of summer in seconds
MELT = dt * (S * (1 - albedo) + (A + B * T) * (beta - 1) + D / 2) / L 'total melt = melt rate * length of summer in seconds
End Function
--------------------------
Bookmarks