Google-sheets – Have a range refer to a given row even if the row number changes

google sheets

I have a table like so:

     A    |   B
------------------
1 || Name | Age
2 || joe  | 28
3 || bob  | 14
4 || Size | Weight
5 || small| 150

And I have a formula to sort each section by column B:

=sort(Sheet1!A2:B3, 2, TRUE)

and

=sort(Sheet1!A5:B, 2, TRUE)

My problem is that, if I insert a new row below row 1, which is a new Name / Age entry in my table, I need to manually go in and change the ranges in my formulas to now be A2:B4 and A6:B

Is there a way that I can somehow refer to to my Size / Weight without using the row number, so that it's always absolutely referred even if the row number changes? Something like putting a label on it and using such label in the range?

So I'd like something like this:

=sort(Sheet1!A2:Size|Weight, 2, TRUE)
=sort(Sheet1!Size|Weight+1:B, 2, TRUE)

Best Answer

Another option:

=SORT(FILTER(Sheet1!A2:B,ROW(Sheet1!A2:A)<MATCH("Size",Sheet1!A:A,0)),2,1)