Removing consecutive number sets

Ailana

New Member
Joined
Feb 7, 2023
Messages
6
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
From a list of 6 digit number sets, is there a way to remove all sets that have a 4 or more digit consecutive sequence in it?
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Not sure what you are looking for exactly, but here is a 365 function that will find if a set has 4 or more consecutive digits in it:

MrExcelPlayground15.xlsx
AB
1100000TRUE
2100002
3100003
4100005
5100007
6100009
7100010
8100011
9100012
10100016
11100017
12100021
13100022
14100023
15100024
16100025
17100026
18100030
Sheet22
Cell Formulas
RangeFormula
B1B1=LET(a,A1:A18,b,SEQUENCE(ROWS(a)-1),c,--(INDEX(a,b+1)-INDEX(a,b)=1),d,SEQUENCE(ROWS(c)-2),e,(INDEX(c,d)=1)*(INDEX(c,d+1)=1)*(INDEX(c,d+2)=1),SUM(e)>0)
 
Upvote 0
Not sure what you are looking for exactly, but here is a 365 function that will find if a set has 4 or more consecutive digits in it:

MrExcelPlayground15.xlsx
AB
1100000TRUE
2100002
3100003
4100005
5100007
6100009
7100010
8100011
9100012
10100016
11100017
12100021
13100022
14100023
15100024
16100025
17100026
18100030
Sheet22
Cell Formulas
RangeFormula
B1B1=LET(a,A1:A18,b,SEQUENCE(ROWS(a)-1),c,--(INDEX(a,b+1)-INDEX(a,b)=1),d,SEQUENCE(ROWS(c)-2),e,(INDEX(c,d)=1)*(INDEX(c,d+1)=1)*(INDEX(c,d+2)=1),SUM(e)>0)
Thank you! But I’m not sure if that’s what I need. I might need to try to explain better…I have a list of numbers such as-
1 5 12 24 25 30
3 4 5 6 9 17
5 8 13 44 45 46
22 24 25 29 40 41

I want to find and remove all sets that have an unbroken sequence of 4 or more consecutive numbers like the second set of numbers listed above.
I hope that is clear :)
 
Upvote 0
Here is something with a helper column which I don't care for:
MrExcelPlayground15.xlsx
ABCDEFGH
251512242530TRUE
263456917FALSE
275813444546TRUE
28222425294041TRUE
29
30
311512242530
325813444546
33222425294041
Sheet22
Cell Formulas
RangeFormula
H25:H28H25=LET(a,A25:F25,b,SEQUENCE(COLUMNS(a)-1),c,--(INDEX(a,b+1)-INDEX(a,b)=1),d,SEQUENCE(ROWS(c)-2),e,(INDEX(c,d)=1)*(INDEX(c,d+1)=1)*(INDEX(c,d+2)=1),SUM(e)=0)
A31:F33A31=FILTER(A25:F28,H25:H28)
Dynamic array formulas.
 
Upvote 0
I’m not sure I care for this one either , lol. Each set of numbers is in its own cell on my sheet. So what I am trying to do is just get rid of any set with the 4+ digit criteria. I feel like it’s simpler to do than I think but I’m no guru lol.
 
Upvote 0
If your six numbers are in A1:F1,
you are looking to find if D1-A1= 3 or E1-B1=3 or F1-B1 = 3

or if MIN(D1:F1 - A1:C1) = 3
 
Upvote 0
My six numbers sets are in cells columns (like A1:A50). How would I look in that case? Sorry but for some reason my brain is scrambling on this, could be because this problem infiltrated my dreams last night and messed up my sleep, lol. The example below is how the list is basically set up.
 

Attachments

  • Screen Shot 2023-02-07 at 12.46.06 PM.png
    Screen Shot 2023-02-07 at 12.46.06 PM.png
    136.3 KB · Views: 3
Upvote 0
Use the textsplit function to break your cells apart.

Excel Formula:
=LET(a,VALUE(TEXTSPLIT(H1," ")),b,SEQUENCE(COLUMNS(a)-1),c,--(INDEX(a,b+1)-INDEX(a,b)=1),d,SEQUENCE(ROWS(c)-2),e,(INDEX(c,d)=1)*(INDEX(c,d+1)=1)*(INDEX(c,d+2)=1),SUM(e)=0)
 
Upvote 0
Use the textsplit function to break your cells apart.

Excel Formula:
=LET(a,VALUE(TEXTSPLIT(H1," ")),b,SEQUENCE(COLUMNS(a)-1),c,--(INDEX(a,b+1)-INDEX(a,b)=1),d,SEQUENCE(ROWS(c)-2),e,(INDEX(c,d)=1)*(INDEX(c,d+1)=1)*(INDEX(c,d+2)=1),SUM(e)=0)
 
Upvote 0
I absolutely appreciate your assistance. I may just need to submit to the fact that I am not an excel expert even with your brilliant help. I can't seem to get it right but I thank you so much.
 
Upvote 0

Forum statistics

Threads
1,215,079
Messages
6,122,998
Members
449,092
Latest member
masterms

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top