I am looking for a formula that evaluates whether there are exactly X number of consecutive values in any order (argument 1) including Y number of gaps/missing values (argument 2).
Example 1:
The range is A1:A10
The values are: 53, 52, 51, 1, 3, 4, 2, 21, 8, 7.
Formula argument 1: 4
Formula argument 2: 0
I.e., I want to test whether there are exactly 4 consecutive values in this range in any order, not allowing for gaps or missing values. The formula would return TRUE or 1, since the range contains: 1, 2, 3, 4.
Example 2:
The range is A1:A10
The values are: 53, 52, 51, 1, 3, 4, 2, 21, 8, 5.
Formula argument 1: 4
Formula argument 2: 0
I.e., as above but the formula would return FALSE or 0, since the range contains consecutive series of 3 (51, 52, 53) and 5 (1, 2, 3, 4, 5) but not 4.
Example 3:
The range is A1:A10
The values are: 53, 52, 51, 1, 16, 4, 2, 21, 8, 7.
Formula argument 1: 4
Formula argument 2: 1
I.e., I want to test whether there are exactly 4 consecutive values in this range in any order, including 1 gap or missing value. The formula would return TRUE or 1, since the range contains: 1, 2, GAP, 4 and GAP, 51, 52, 53 and 51, 52, 53, GAP.
I have not been able to produce any formula to do this but instead have to work with a workaround where I do vlookups against a large permutation of possible series which makes operations in the spreadsheet very slow.
Any help or pointers in the right direction is greatly appreciated!
Example 1:
The range is A1:A10
The values are: 53, 52, 51, 1, 3, 4, 2, 21, 8, 7.
Formula argument 1: 4
Formula argument 2: 0
I.e., I want to test whether there are exactly 4 consecutive values in this range in any order, not allowing for gaps or missing values. The formula would return TRUE or 1, since the range contains: 1, 2, 3, 4.
Example 2:
The range is A1:A10
The values are: 53, 52, 51, 1, 3, 4, 2, 21, 8, 5.
Formula argument 1: 4
Formula argument 2: 0
I.e., as above but the formula would return FALSE or 0, since the range contains consecutive series of 3 (51, 52, 53) and 5 (1, 2, 3, 4, 5) but not 4.
Example 3:
The range is A1:A10
The values are: 53, 52, 51, 1, 16, 4, 2, 21, 8, 7.
Formula argument 1: 4
Formula argument 2: 1
I.e., I want to test whether there are exactly 4 consecutive values in this range in any order, including 1 gap or missing value. The formula would return TRUE or 1, since the range contains: 1, 2, GAP, 4 and GAP, 51, 52, 53 and 51, 52, 53, GAP.
I have not been able to produce any formula to do this but instead have to work with a workaround where I do vlookups against a large permutation of possible series which makes operations in the spreadsheet very slow.
Any help or pointers in the right direction is greatly appreciated!
Last edited by a moderator: