# Count Rows in a Dynamic Range

#### joseulloa22

##### New Member
Hello- good morning
Looking for help. The below table can start in any row (i.e, cell A17= "Components" could be in A150). Columns will remain as it shows . In column I (starting in I22 in this case), I would like to have the content of B22. On this case, I used the following formula but since my # of rows will change I think that rather than using A21 I would need a dynamic reference but not sure how to do that

=OFFSET(INDEX(A:A,MATCH("Components",A:A,0)),ROWS(INDEX(A:A,MATCH("Components",A:A,0)):A21),1)

Last edited:

#### pjmorris

##### Well-known Member
How do you place your formula? If it is always placed in Column I and at the same row as the first Identification, for the example above it would be simply =B22 and copy down, but that seems too trivial.

If the copy of the id might be on some other row in Column I then if the first cell you have the formula in is in Row 2 you could use (change the Row()+2 element so the 2 reflects the row the formula is in):

Rich (BB code):
``=OFFSET(\$A\$1, MATCH("Components",A:A,0)+ROW()+2,1)``

An alternative formula is shown below, and this works wherever you move the data too:

Book1
ABCDEFGHI
1
2|__A
3|__B
4|__C
5|__D
6|__E
7|__F
8
9
10Components
11Short
12
13IdentificationWhsRequiredTotal req'dAvailShortErrors
14********************
15|__A16/22/2020135135no|__A
16|__B|__B
17|__C|__C
18|__D|__D
19|__E|__E
20|__F|__F
Sheet1
Cell Formulas
RangeFormula
I2:I7I2=OFFSET(\$A\$1, MATCH("Components",A:A,0)+ROW()+2,1)
I15:I20I15=OFFSET(\$A\$1, MATCH("Components",A:A,0)+ROW()-(1+MATCH("Components",A:A,0)),1)

HTH

### Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

#### joseulloa22

##### New Member
Peter, the second formula =OFFSET(\$A\$1, MATCH("Components",A:A,0)+ROW()-(1+MATCH("Components",A:A,0)),1), worked real nice in any row I throw my data between col A and H. It is pulling the content from col B and placing into respective cells in col I. That's phenomenal, thanks so much!
Thanks C Moore and C_Punit as well

#### pjmorris

##### Well-known Member
Delighted to have helped and many thanks for the feedback.

Replies
2
Views
42
Replies
6
Views
64
Replies
2
Views
55
Replies
0
Views
115
Replies
1
Views
83

1,130,405
Messages
5,641,943
Members
417,248
Latest member
BStew

### 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.

### Which adblocker are you using?

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

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