SeT
SeT

Reputation: 224

Excel formula to pick difference between 2 columns but only if difference is less than 1

I'm looking for an excel formula that picks a difference between 2 columns, but only if the value in column A is equal or maximum less than 1 in column B (either way). My table is as follows:

enter image description here

I know my logic below is wrong but I tried the below formula and it only picks equal values:

=IF(I2=O2,"Yes",IF(I2>=(SUM(O2+1)),"Yes",IF(I2<=(SUM(O2+1)),"Yes")))

Can you please advise how to modify the above formula to get the right results? Thanks in advance.

Upvotes: 1

Views: 480

Answers (1)

BigBen
BigBen

Reputation: 50008

If I understand your question correctly - use ABS on the difference and check if <=1.

=IF(ABS(A2-B2)<=1,"Yes","No")

enter image description here

Upvotes: 4

Related Questions