Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

True if X consecutive numbers in a cell

I’m using Excel 365 and would like to stipulate whether it is true or not that the text cell I’m looking at has x amount of consecutive numbers.
For this example, I would like to know when there is 5 consecutive numbers in the cell:

Text cell True?
AB 131 FALSE
50353 GO TRUE
A A 6 FALSE
CV90356 TRUE
TT 2041 FALSE
13190 13224 TRUE

As you can see it will return TRUE if five consective numbers appear in the cell, even if there are two lots of this sequence in the cell. What formula could I use to achieve this? Thanks in advance.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You could try using the following formula:

enter image description here


=MAP(A2:A7,LAMBDA(x,OR(LEN(TEXTSPLIT(x,TEXTSPLIT(x,SEQUENCE(10)-1,,1),,1))=5)))

Or, as commented above:

=OR(LEN(TEXTSPLIT(A2,TEXTSPLIT(A2,SEQUENCE(10)-1,,1),,1))=5)

Or,

=OR(LEN(IFERROR(--MID(A2,SEQUENCE(LEN(A2)),5),0))=5)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading