# 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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

#### 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
45
Replies
0
Views
107
Replies
1
Views
71
Replies
5
Views
74
Replies
1
Views
78

1,128,107
Messages
5,628,731
Members
416,333
Latest member
Time2Learn

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

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