VBA Count one number followed by another

Stephen_IV

Well-known Member
Joined
Mar 17, 2003
Messages
1,168
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Good evening,

I need to do certain counts of pairs. At work we have certain tasks (16) to where each employee has to participate. I need to check daily to see if certain employees are completing tasks one after the other. For this example I need to count 15 followed by 16. Cannot be 16 and 15 has to be 15 then 16. The example count below would be 3. Any help would be appreciated.


Book1
ABCDEFGHIJKLMNOP
2211516141116121215161215163
Sheet2
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
=SUMPRODUCT(($B$2:$O$2=16)*($A$2:$N$2=15))
 
Upvote 0
.. or if you have the COUNTIFS function

Book1
ABCDEFGHIJKLMNOP
1211516141116121215161215163
Countifs
Cell Formulas
RangeFormula
P1P1=COUNTIFS(A1:N1,15,B1:O1,16)
 
Upvote 0

Forum statistics

Threads
1,215,455
Messages
6,124,938
Members
449,197
Latest member
k_bs

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