How to count occurrences of two or three numbers in different rows?

kirvist

New Member
Joined
Apr 16, 2015
Messages
3
After value 4, goes value 2. I looking for formula to count, how many times that occurs in the table. Best, if formula is flexible, where you can input different values. If say, value 7, then value 2. Maybe it is possible to count sequence of three numbers.
Then using =COUNTIFS(B2:B9622,4), result is 535. If using formula =COUNTIFS(B2:B9622,$E$3,B2:B9622,$G$3), where $E$3 = 4, and $G$3 = 2, I get 0.
So, to count how many times combination 4 then 2 occurs, what need to be done?

Thank you

DateValue
11
24
32
47
52
61
71
83
91
1018
111
121
131
143
152
163
172
185
191
201
211
221
231
241
251
262
272
285
291
301
311
324
332
3411
351
3619
371
381
391
406
411
422
432
441
451
463
471
485
491
504
511
5218
531
541
551
569
571
585
591
604
611
623
632
642
651
662
671
682
691
701
712
723
731
743
752
767
772
785
791
803
811
822
831
847
851
867
871
887
891
902
913
926
931
943
951
962
971
986
991
1009
1011
1024
1031
1043
1051
1061
1071
10813
1091
1101
1111
1126
1132
1148
1151
1166
1171
11816
1191
1208
1211
1228
1231
1241
1251
1262
1271
1288
1291
1301
1311
13219
1332
1345
1351
1362
1372
1382
1391
1401
1411
1426
1432
1446
1451
1462
1471
1485
1491
1505
1511
1522
1531
15421
1553
15615
1571
1581
1591
1601
1611
1622
1632
1641
1651
1663
1671
1682
1691
1701
1711
1722
1731
17411
1751
17613
1771
1785
1791
1801
1812
1825
1832
1849
1851
1863
1872
1881
1892
19013
1911
1923
1931
1943
1951
1961
1971
1981
1991
2006
2011
2022
2031
2041
2052
2061
2071
2083
2091
2104
2112
2124
2131
2149
2151
2165
2171
21811
2191
2201
2212
2227
2233
2244
2251
2262
2271
2287
2291
2304
2313
23216
2331
2342
2352
2365
2371
2381
2391
2401
2412
2425
2431
2446
2451
2461
2472
2484
2491
25010
2511
2524
2531
2541
2551
2561
2571
2584
2591
2601
2612
2621
2632
26411
2651
2662
2671
2682
2691
2702
2711
2722
2732
2742
2751
2766
2771
2783
2791
2804
2811
2822
2831
2842
2855
2864
2871
2884
2891
2901
2911
2923
2931
2941
2951
2966
2971
2987
2992
3008
3011
3028
3031
3043
3051
3061
3072
3081
3091
3105
3112
31213
3131
3148
3151
3162
3171
3184
3191

<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>
</tbody>
<!--[endif]-->
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
You could offset your ranges like this:

=COUNTIFS(B2:B320,E3,B3:B321,G3)
 
Upvote 0
Hi Kirvis,

Thanks for coming back, glad you got it sorted.

Steve's solution was a new one on me, always learning :)

Eric
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,582
Members
449,039
Latest member
Arbind kumar

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