• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Gaps in a series of numbers, with conditions

bines53

Active Member
Hello friends,

I'm looking for a solution, how do I find the correct numbers.
For example, given 10 numbers in ascending order,
1
3
20
40
48
63
68
70
83
100

I have to find them numbers, if I will place them in the current series, the absolute gap will be not less than 7.

Correct numbers are,
10 ,11 ,12 ,13 ,27 ,28, 29 ,30, 31 ,32 ,33, 41 ,55 ,56 ,90 ,91 ,92 ,93.
For example, number 89, is not true, because the number of ninth in the series, 83, less than 89 gives 6 .

Thank you !
 
Hi David ,

Something like this ?

I have assumed that only one number can be inserted in between two numbers ; if the gap is bigger , then this logic will not work.

Narayan
 

Attachments

  • Book31.xlsx
    8.8 KB · Views: 7
Hi David ,

Isn't OFFSET your most unfavoured function ?!

I think using OFFSET will be more cumbersome , since it does not allow the first parameter to be anything other than a reference.

Narayan
 
Hi Narayan,

Another question, following the final solution, is there a way to find the total, who are conditioned, that is, the answer should be 17,


Thank you !

David
 
Hi David ,

If you make use of the helper outputs , a simple COUNTIF will return the wanted result , but without these outputs , it is more difficult. I am not sure I can help.

Narayan
 
Hi Narayan,

I made some changes according to your logic, if I can improve more, I'll update.


Thank you !

David
 

Attachments

  • GAP-1.xlsx
    10.5 KB · Views: 2
Hi Narayan,

The solution to find the total =17
Now I check, if you can get all the numbers, One formula, you see what inspiration you gave me?

David
 

Attachments

  • GAP-1.xlsx
    10.6 KB · Views: 6
Hi again!

Another One (no CSE in column E):

=IF(ROWS(E$2:E2)>D$1,"",AGGREGATE(15,6,COLUMN(A$1:INDEX($1:$1,MAX(A:A)))/((COLUMN(A$1:INDEX($1:$1,MAX(A:A)))>=A$2:A$11+G$1)*(COLUMN(A$1:INDEX($1:$1,MAX(A:A)))<=A$3:A$12-G$1)),ROWS(E$2:E2)))

Blessings!
 
Back
Top