Here's the code from our tools. You just put it into Visual Basic part of Excel.
Global Const FNULL = -3.4E+38
Global Const DNULL = -3.4E+38
Global Const TRF = 459.67
Function third_cs#(ByVal Vis1#, ByVal TempF1#, ByVal Vis2#, ByVal TempF2#, ByVal TempF3#)
' ******************** THIRD_CS **************************
' Function for obtaining a third Centistoke viscosity, given two
' input values and temperatures.
' input: centistoke viscosity
' temperature measured at, F
' centistoke viscosity
' temperature measured at, F
' 3rd temperature measurement desired, F
' returns: 3rd Centistoke viscosity
' Date: April 30, 1990 Author: Ralph R. Hall
' RevDate: 14 Sep 94 Author: Ralph R. Hall
' The ASTM equation is log log(cs+.7)=a+b log(t), the logs are
' base 10. The .7 constant is not .7 at low cs values.
' The revision was included based on pg. 139 of the ASMTM
' manual, giving the equation in D 341 for going below 2
' Cs viscosity.
' *******************************************************
' TEMPERATURES MUST BE DEGREES F
Dim dAcon#, dBcon#, dVm3#
If Vis1 > Vis2 And TempF1 > TempF2 Then
third_cs = FNULL
ElseIf TempF1 = TempF2 Then
third_cs = Vis2
ElseIf TempF3 = TempF1 Then
third_cs = Vis1
ElseIf TempF3 = TempF2 Then
third_cs = Vis2
Else
Call astm_d341_cons(Vis1, TempF1, Vis2, TempF2, dAcon, dBcon)
dVm3 = dAcon + dBcon * log10(TempF3 + TRF)
third_cs = astm_d341_vm(dVm3, False)
End If
End Function
Sub astm_d341_cons(Vis1#, TempF1#, Vis2#, TempF2#, Acon#, Bcon#)
' Determines ASTM D341 slopes from 2 vis values &
' two temperature values.
' Inputs:
' o 1st viscosity, cS
' o 1st temperature, F
' o 2nd viscosity, cS
' o 2nd temperature, F
' Outputs: A constant and B constant in the equation
' Vm = A + B log T
' By Ralph R. Hall Date: 10 November 1996
Dim dVm1#, dVm2#
dVm1 = astm_d341_vm(Vis1, True)
dVm2 = astm_d341_vm(Vis2, True)
Bcon = (dVm2 - dVm1) / (log10(TempF2 + TRF) - log10(TempF1 + TRF))
Acon = dVm2 - Bcon * log10(TempF2 + TRF)
End Sub
Function astm_d341_vm#(ByVal VisOrZ#, Direction%)
' gives an ASTM D341 "vis modulus" from vis (Direction = True)
' or cS value from vis modulus (Direction = False)
' Input: centistokes or vis modulus = loglog(cS + Zcon)
' Output: reverse
' By: Ralph R. Hall Date: 7 November 1996
Dim dVisPlusPt7#, dZval#, dVis#
Dim dCval#, dDval#, dEval#, dFval#, dGval#, dHval#, dPt7Sq#, dPt7Cube#
dCval = 0: dDval = 0: dEval = 0: dFval = 0: dGval = 0: dHval = 0
Select Case Direction
Case True
If VisOrZ <= 20000000# And VisOrZ >= 0.21 Then
dVis = VisOrZ
If dVis < 2# Then
dCval = Exp(-1.14883 - 2.65868 * dVis)
End If
If dVis < 1.65 Then
dDval = Exp(-0.0038138 - 12.5645 * dVis)
End If
If dVis < 0.9 Then
dEval = Exp(5.46491 - 37.6289 * dVis)
End If
If dVis < 0.3 Then
dFval = Exp(13.0458 - 74.6851 * dVis)
End If
If dVis < 0.24 Then
dGval = Exp(37.4619 - 192.643 * dVis)
End If
If dVis >= 0.21 And dVis < 0.24 Then
dHval = Exp(80.4945 - 400.468 * dVis)
End If
dZval = dVis + 0.7 + dCval - dDval + dEval - dFval + dGval - dHval
astm_d341_vm = log10(log10(dZval))
Else
astm_d341_vm = FNULL
End If
Case False
If VisOrZ <= DNULL Then
astm_d341_vm = FNULL
Else
dVisPlusPt7 = 10# ^ (10# ^ VisOrZ)
dVis = dVisPlusPt7 - 0.7
If dVis < 2# Then
dPt7Sq = dVis * dVis
dPt7Cube = dPt7Sq * dVis
dVis = dVis - Exp((-0.7487 - 3.295 * dVis) + 0.6119 * dPt7Sq - 0.3193 * dPt7Cube)
End If
astm_d341_vm = dVis
End If
End Select
End Function