Sub ДвоичныйПоиск()

Sub ДвоичныйПоиск()
    
    txtFind = "01.02.2023"
    
    first = 1
    last = 51
    Length = 50
    half0 = 26
    i = 1
    Length = first + last
    Do While last >= first
        half = Round((first + last) / 2)
        
       If Range("B" & half) = CDate(txtFind) Then
          For Row = half To 50
            If Range("B" & Row) <> CDate(txtFind) Then
                xx = Row
                Exit For
            End If
          Next Row
        Debug.Print "Кол-во операций: " & i & " последний элемент " & xx - 1
        Exit Sub
       End If
        
        If Range("B" & half).Value > CDate(txtFind) Then    'Range("B" & half) > txtFind   'DateDiff("d", txtFind, Range("B" & half)) > 0
            last = half - 1
        Else
            first = half + 1
        End If
    i = i + 1
    Loop
    
    
    
    Debug.Print "Значение не найдено. Кол-во операций " & i
End Sub