Reputation: 123
I've got this formula, which checks if there are any consecutive numbers within the range:
{=IF(SUM(--(ABS(C31:BI31-TRANSPOSE(C31:BI31))=1)),"Yes","No")}
It works perfectly, but I want to exclude zero values from conparison process.
4 6 2 8 0 9 - Result: "Yes"
0 1 7 5 9 2 - Result: "Yes", but it should be "No", since 0 and 1 should not be counted as consecutive numbers.
Upvotes: 0
Views: 85
Reputation: 7762
=IF(SUMPRODUCT(COUNTIFS(C31:BI31,1+1/(1/C31:BI31))),"Yes","No")
Regards
Upvotes: 1
Reputation:
I'm not 100% sure that your original array formula is 'working perfectly'; you might want to double-check the results. Try this standard formula using the newer AGGREGATE function¹ to provide cyclic processing.
=IF(AGGREGATE(15, 6, ABS(C31:BH31-D31:BI31)/((C31:G31<>0)*(D31:BI31<>0)), 1)=1, "yes", "no")
¹ The AGGREGATE function was introduced with Excel 2010. It is not available in earlier versions.
Upvotes: 1