If your report gets too big, UDF might be a better option since it doesn't require as much memory as array formula.
![]()
Public Function ConsecutiveOrders(ByVal PeriodRange As Range) As Integer Dim iCount As Integer Dim vPrvValue As Variant Dim cell As Range iCount = 0 vPrvValue = 0 For Each cell In PeriodRange If cell.Value <> 0 And vPrvValue = 0 Then iCount = iCount + 1 End If vPrvValue = cell.Value Next cell ConsecutiveOrders = iCount End Function
Bookmarks