
Option Explicit
Function count_sequences(r As Range) As Integer
Dim cell As Range, val_cell As Integer, tot As Integer
For Each cell In r.Resize(, r.Columns.Count - 1)
val_cell = Val(cell)
If val_cell <> 0 And Abs(val_cell - cell.Offset(, 1)) = 1 Then tot = tot + 1
Next
count_sequences = tot
End Function |
