Countif within Variable row based on label

Dgenty

New Member
Joined
Sep 8, 2014
Messages
19
Hi all,

I need to count the number times certain text appears in a column between variable rows. Really struggling to find a way to do this and any help is appreciated.

So in the example below How can I count all instance of "3.5 Tonne" if it appears between the labels "Gas installer" and "level 1 specialist" which are actual in column I in my spreadsheet and the 3.5 tonne appears in column K. Again these rows may change in placement and number of everyday.


[TABLE="width: 677"]
<tbody>[TR]
[TD]CPW Run[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Route[/TD]
[TD]Operator ID[/TD]
[TD]Vehicle Type[/TD]
[TD]Hours[/TD]
[TD]Registration[/TD]
[TD]Operator[/TD]
[TD]Primary[/TD]
[TD]Mate[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]7 Tonne Unmarked[/TD]
[TD="align: right"]08:12[/TD]
[TD]Test 1[/TD]
[TD]Company[/TD]
[TD]Test 1[/TD]
[TD]N/A[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]7 Tonne Unmarked[/TD]
[TD="align: right"]09:22[/TD]
[TD]Test 2[/TD]
[TD]Company[/TD]
[TD]Test 2[/TD]
[TD]N/A[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Gas Installer[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Route[/TD]
[TD]Operator ID[/TD]
[TD]Vehicle Type[/TD]
[TD]Hours[/TD]
[TD]Registration[/TD]
[TD]Operator[/TD]
[TD]Primary[/TD]
[TD]Mate[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]3.5 Tonne[/TD]
[TD="align: right"]09:15[/TD]
[TD]Test1[/TD]
[TD]Company[/TD]
[TD]Test1[/TD]
[TD]Agency Mate 30[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]3.5 Tonne[/TD]
[TD="align: right"]09:15[/TD]
[TD]Test2[/TD]
[TD]Company[/TD]
[TD]Test2[/TD]
[TD]Agency Mate 27[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]3.5 Tonne[/TD]
[TD="align: right"]09:15[/TD]
[TD]Test3[/TD]
[TD]Company[/TD]
[TD]Test3[/TD]
[TD]Agency Mate 25[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]3.5 Tonne[/TD]
[TD="align: right"]09:15[/TD]
[TD]Test4[/TD]
[TD]Company[/TD]
[TD]Test4[/TD]
[TD]Agency Mate 29[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]3.5 Tonne[/TD]
[TD="align: right"]09:15[/TD]
[TD]Test5[/TD]
[TD]Company[/TD]
[TD]Test5[/TD]
[TD]Agency Mate 22[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]3.5 Tonne[/TD]
[TD="align: right"]09:15[/TD]
[TD]Test6[/TD]
[TD]Company[/TD]
[TD]Test6[/TD]
[TD]Agency Mate 24[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Level 1 Specialist[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Will it always be between "Gas Installer" and "Level 1 Specialist" you want to search?
More importantly will you always know the start and end points ("range") you want to search between?
 
Upvote 0
Yes it will always be between these 2 labels the search needs to go from. They will always be in the same columns but the number of rows and where the rows start and finish may differ day to day. its a difficult one.
 
Upvote 0
Does "Gas Installer" and "Level 1" always appear ONCE in the column or could there be more occurrences of them in that column?

If they only occur once in the column use this

=MATCH("Level 1 Specialist",A1:A20,0)-MATCH("Gas installer",A1:A20,0)-3
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,322
Members
452,635
Latest member
laura12345

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