Count number of entries between specific words

FryGirl

Well-known Member
Joined
Nov 11, 2008
Messages
1,364
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I'm looking for two different counts. First, would like to count number of entries in-between the word Major Task and then a count to exclude the "No" between the word Major Task. Results are in column C & D respectively.

Data Range

A​

B​

C​

D​

1​

Hdr1​

Hdr2​

Hdr3​

Hdr4​

2​

Major Task​

5​

4​

3​

Sub Task​

No​

4​

Sub Task​

Yes​

5​

Sub Task​

Yes​

6​

Sub Task​

Yes​

7​

Sub Task​

Yes​

8​

Major Task​

6​

6​

9​

Sub Task​

Yes​

10​

Sub Task​

Yes​

11​

Sub Task​

Yes​

12​

Sub Task​

Yes​

13​

Sub Task​

Yes​

14​

Sub Task​

Yes​

15​

Major Task​

3​

2​

16​

Sub Task​

Yes​

17​

Sub Task​

No​

18​

Sub Task​

Yes​

<tbody>
</tbody>
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Maybe:


ABCD
1Hdr1Hdr2Hdr3Hdr4
2Major Task54
3Sub TaskNo
4Sub TaskYes
5Sub TaskYes
6Sub TaskYes
7Sub TaskYes
8Major Task66
9Sub TaskYes
10Sub TaskYes
11Sub TaskYes
12Sub TaskYes
13Sub TaskYes
14Sub TaskYes
15Major Task32
16Sub Task
17Sub TaskNo
18Sub TaskYes

<tbody>
</tbody>
Sheet9

Worksheet Formulas
CellFormula
C2=IF(<font color="Blue">A2="Major Task",IFERROR(<font
MATCH(<font color="Green">"Major Task",OFFSET(A3,0,0,100),0)-1,COUNTA(OFFSET(A3,0,0,100))</font
),"")
D2=IF(C2<>"",COUNTIF(OFFSET(B3,0,0,C2),"Yes"),"")

<tbody>
</tbody>

<tbody>
</tbody>



The 100 in the formula is the maximum number of Sub-tasks you'll have between Major Tasks.
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,583
Members
449,174
Latest member
chandan4057

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