Quote Originally Posted by Excel Fox View Post
Here's a VBA solution

Code:
Function fPhaseInOutMonth(rngSource As Range) As Long

    Dim lngCol As Long: lngCol = rngSource.Columns.Count
    If rngSource(1, lngCol).Value = 0 Then
        For lngCol = lngCol - 1 To 1 Step -1
            If rngSource(1, lngCol).Value <> 0 Then
                fPhaseInOutMonth = lngCol + 1
                Exit Function
            End If
        Next lngCol
    Else
        For lngCol = lngCol - 1 To 1 Step -1
            If rngSource(1, lngCol).Value = 0 Then
                fPhaseInOutMonth = lngCol + 1
                Exit Function
            End If
        Next lngCol
    End If
    fPhaseInOutMonth = 1
    
End Function

Thank you so much. The code works wonderfully!

I appreciate it greatly! Sorry I did not get back to you sooner.