# Help With A Formula Currently in Visual Basic

• 0
• Question
• Updated 3 years ago

I have the following VB formula which basically checks the value in four fields and then provides percentage  achievement.  I am trying to mimic the same thing in QB functions but not having much luck. Will appreciate some help.

Function Rate(varSpeDateOrd As Variant, VarPrimSecOrd As Variant, varSignOrderDate As Variant, varRefOrderDate As Variant) As Double

Dim var1 As Variant

Dim var2 As Variant

Dim var3 As Variant

Dim var4 As Variant

If Not IsNull(varSpeDateOrd) Then

var1 = 0.6

End If

If Not IsNull(VarPrimSecOrd) Then

var2 = 0.3

End If

If Not IsNull(varSignOrderDate) Then

var3 = 0.05

End If

If Not IsNull(varRefOrderDate) Then

var4 = 0.05

End If

Rate = (var1 + var2 + var3 + var4)

End Function

• 3,152 Points

Posted 3 years ago

• 0

QuickBaseCoach App Dev./Training, Champion

• 67,448 Points
If(not IsNull([Field 1]), 0.6,0)
+
If(not IsNull([Field 2]), 0.3,0)
+
If(not IsNull([Field 3]), 0.05,0)
+
If(not IsNull([Field 4]), 0.05,0)

Note that the IsNull may not be used for text fields, but it appears that you have 4 Date fields.
• 3,152 Points
Thanks a lot.  Very nice and elegant solution.