I'm trying to write a custom formula that shows me the reason of low On-Shelf-Availability a.k.a. OSA. I've planted all those nested if statements and expected to see the text from debug.print statement, but in all the cases I have, i receive 0 as the answer. What i did wrong?
Code is Below
*Option Explicit*
Function Octopus (PNZ As Double, OSA As Double, SL As Double, Current_Stock As Integer, SO_Month As Integer, Client_SI_Forecast As Integer, SO_FCST As Integer, SO_Fact As Integer, Availability_Report As Double, Client_FA As Double, OTIF As Double)
'Make formula update like an excel formula
Application.Volatile True
If Current_Stock / PNZ >= 1 Then
    
    'OSA Check
    If OSA > 0.9 Then
        ' Checking Sell Out dynamics
        If SO_Fact / (1 - PNZ) > 1.2 * Client_SI_Forecast Then
            Debug.Print " Under Forecast. Increase PNZ"
        Else
            Debug.Print "No Problems Discovered"
        End If
    
    Else
        ' Checking if SO is zero
        If SO_Fact > 0 Then
            ' Comparing Stock to its monthly average
            If Current_Stock < SO_Month Then
                Debug.Print "No Spare space on shelf, possible virtual stock"
            Else
                Debug.Print "No Spare space on shelf, possible delay on layout"
            End If
            
        Else
            Debug.Print "Virtual Stock"
        End If
    End If
        
Else
    If OSA > 0.9 Then
        If Availability_Report > 0.9 Then
            Debug.Print "No Problems Discovered"
        Else
            Debug.Print "Incorrect PNZ tuning"
            End If
    Else
        If SL > 0.9 Then
            If PNZ > SO_Fact * 2 / 7 Then
                If Client_FA > 0.8 Then
                    Debug.Print "Double-Check PNZ"
                Else
                    Debug.Print "Adress FA Issue to Client Forecasting Team"
                End If
            Else
                Debug.Print " Update PNZ value"
                End If
        Else
            If OTIF > 0.8 Then
                Debug.Print " We Didn't have product"
            Else
                Debug.Print " Issues with our logisttics "
                End If
        End If
    End If
    
End If
End Function
 
    