can't get the A1>A2 by more then 1 to equal=0

here’s what I need

A1>A2 by more then 1 to equal =0
A1>A2 by 1 to equal =1
A1=A2 to equal=2
A1<A2 to equal =3

Please don’t forget to format your formatted data as such, using dedicated toolbar button “preformatted text”.

Hello

=IFS(A1>(A2+1),0,A1=(A2+1),1,A1=A2,2,A1<A2,3)

… and again, the case when A1 is between A2 and A2+1 is undefined :slight_smile:

Thank you You are the best

… if not restricted to the set of integers :slight_smile: