If you are wanting
Part A: DataUnitValue = (((Val - GridMin)/TotalVal) * 8)
and
Part B: DataUnitValue = (((Val + Abs(GridMin))/TotalVal) * 8)
a single equation ... maybe
Globals
Dim valueBelowZero, valueAboveZero as Int = 0
... Then in your code ...
If GridMin > 0 Then
valueAboveZero = 1
valueBelowZero = 0
Else
valueAboveZero = 0
valueBelowZero = 1
End If
DataUnitValue = (((((Val - GridMin) * valueAboveZero) + valueBelowZero) * ((Val + Abs(GridMin) * valueBelowZero) + valueAboveZero)) / (TotalVal * 8))
Whoa parenthesis overload.
I think, in this case, you would need to have a pair of "Int"s to help the equation along.
The equations should, essentially de-activate the equation not needed, making it equal to 1, which is then multiplied by the other half "activating" the required equation. If this wasn't what you needed sorry.
Let me know if this works ... or if it was super confusing.
Kight