differentials patterns

excelNewbie22

Well-known Member
Joined
Aug 4, 2021
Messages
510
Office Version
  1. 365
Platform
  1. Windows
i have a file of thousands of lines with numbers, let's say:

5 11 25 26 28 40
2 20 22 23 30 31
6 7 10 11 19 20
10 12 15 17 20 22

and i want, by formula, to check for example if there is a pattern of differential of 2 (between 2 following numbers) then 3 then 2 then 3 and so on,
and like i say this is just an example, cause i want to check lot's of patterns like that,
so i want to be able to modify the formula each time to my needs, like to 3 and then 4 then 3 and so on....

and if possible for the formula to check the entire file at once (like c2:h2000) but to check only horizontal lines (c2:h2 then c3:h3 and etc)
and return how many matched, like 10 or 20...

thank u all for your time and expertise!
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
If you put this formula in cell J2 and copy down, you will have a column with all your differential (separated by a space) in them... you can now write a simple formula to check any given pattern. For example, put your pattern in cell K1 (e.g., 2 3 2 3 2) and then put this formula in cell K2 and copy it down...

=IF(K$1=J2,1,"")

and every row whose differentials match your pattern will be shown with a 1 in it. To find out how many of these pattern matches there are, simply SUM column K...

=SUM(K:K)

You can now test other patterns by simply changing the differential pattern in cell K1.
 
Upvote 0
Mr Excel Playground 3.xlsm
CDEFGHI
123232
25710121517TRUE
3345678FALSE
46811131618TRUE
5056111217FALSE
Sheet16
Cell Formulas
RangeFormula
E1:G1E1=C1
I2:I5I2=AND((D2:H2-C2:G2)=ROW(INDIRECT("1:5"))*0+1*$C$1:$G$1)
 
Upvote 0
rick, if u'r willing to explain again please, maybe with an example?

22
ABCDEF
1123456
251125262840
322022232425
4101215172022
גיליון1


james, it's working good, thank u very much!
i just want to understand if rick's is easier for me
 
Upvote 0
Here's another option:
Book4
CDEFGHIJ
123232# of matches
25710121517TRUE3
3345678FALSE
46811131618TRUE
5056111217FALSE
6FALSE
724791214TRUE
Sheet8
Cell Formulas
RangeFormula
J2J2=SUMPRODUCT(--(MMULT(--((D2:H12-C2:G12)=$C$1:$G$1),{1;1;1;1;1})=5))
I2:I7I2=AND((D2:H2-C2:G2)=$C$1:$G$1)


You can sum up the TRUE/FALSE values in column I with

Excel Formula:
=SUMPRODUCT(I2:I12+0)

But the J2 formula calculates the same total without needing column I.
 
Upvote 0
Solution

Forum statistics

Threads
1,214,515
Messages
6,119,973
Members
448,933
Latest member
Bluedbw

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