My 2 cents --
1. Instead of trying to determine the answer in a single statement, you could use intermediate variables to hold intermediate results
2. I'd try to have the macro follow your logic rules more closely
3. I just plugged in sizes to test the algorithm, which is much easier to do in a single bite (byte ?) size macro instead of the full blown application
4. The code can be made more concise, but IMHO at the expense of clarity
Option Explicit
'Flat package -
' shortest diamension less than or equal to 8
' AND medium diamension is four or more times larger than shortest diamension
' AND the volume is equal to or more than 800
'Elongated package -
' Longest diamension Is 36 Or more
' AND both other diamensions are 20 percent or less of the longest diamension
' If package qualifies as both flat and elongated, then
' following message showed show "Package qualifies as both elongated and flat. Test in accordance with elongated procedure ".
'If neither are satisfied then its a standard package
Sub test()
Dim Longest As Double, Medium As Double, Shortest As Double, Volume As Double
Dim bFlat As Boolean, bElongated As Boolean
'algorithm testing
Longest = 30
Medium = 10
Shortest = 4
Volume = Longest * Shortest * Medium
If (Shortest <= 8) And (4 * Shortest <= Medium) And (Volume >= 800) Then
bFlat = True
Else
bFlat = False
End If
If (Longest >= 36) And (Medium <= 0.2 * Longest) And (Shortest <= 0.2 * Longest) Then
bElongated = True
Else
bElongated = False
End If
If bFlat And bElongated Then
MsgBox "Package qualifies as both elongated and flat. Test in accordance with elongated procedure"
ElseIf bFlat Then
MsgBox "it is flat"
ElseIf bElongated Then
MsgBox "It is elongated"
Else
MsgBox " it is standard"
End If
End Sub