helpexcel

Well-known Member
Joined
Oct 21, 2009
Messages
656
Hi - If i have Data in column A, that also has multiple headings, is there a way for me to say in A:A count cells between "Beach" and "Baseball"?
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
One way would be
Code:
Sub Maybe()
    MsgBox Range(Columns(1).Find("Beach").Offset(1), Columns(1).Find("Baseball").Offset(-1)).Cells.Count
End Sub
 
Upvote 0
What is the expected result for the scenario below?


A
1
2
3
4
Baseball​
5
6
Beach​
7

M.
 
Upvote 0
Code:
=MATCH("Baseball", A2:A29, 0)-MATCH("Beach", A2:A29, 0)-1

If you don't know which value is going to be the first one, you might have to resort t something like this.
Code:
Sub Maybe_C()
Dim i As Long, ii As Long
i = ActiveSheet.Columns(1).Find("Beach").Row
ii = ActiveSheet.Columns(1).Find("Baseball").Row
    MsgBox IIf(ii > i, ii - (i + 1), i - (ii + 1))
End Sub

@Marcelo
We'll wait for an answer I guess but the way I read the first Post, it should be 1 (one)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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