Recognition of Discontinuous Two Same Values in Excel Table Data

1. Data introduction.

In column A, 1, 2, 4, 6, 7, 8 are consecutive two identical values, that is, in the context, there are and only two consecutive numbers are the same; 3, 5, 9 are non-contiguous two identical values, among which 3, 9 is a continuous same value, 5 is a continuous three same value.
Insert picture description here

2. Enter the function and perform the calculation.

Enter the function into cell B3 as follows, and recognize that consecutive two equal values ​​are 0, and non-consecutive two equal values ​​are 1.

=IF(OR(AND(A2=A3,A3=A4),AND(A2<>A3,A3<>A4)),1,0)

Insert picture description here

3. Double-click the cell, the result is as follows.

Successfully recognize that consecutive two identical values ​​1, 2, 4, 6, 7, and 8 are 0; non-consecutive two identical values ​​3, 5, and 9 are 1.
Insert picture description here

Guess you like

Origin blog.csdn.net/peter_young1990/article/details/114478017