Forum Discussion
Change the absolute reference into new one whenever copy to new location
Thank you.
chavanpr12 , if format a bit and take the formula for the first cell of the second range
=IF((MAX(
INDEX(A:A,
IFERROR(AGGREGATE(14,6,1/($A$1:A10="")*ROW($A$1:A10),1)+1,1)):
INDEX(A10:A$1048576,
MATCH(1,INDEX(--(A10:A$1048576=""),0),0)-1))
=A10),A10,0)
AGGREGATE returns the first (4th parameter 1) largest (first parameter 14) value in the array (3rd parameter) ignoring all errors (second parameter 6).
Our array here is multiplication of criteria 1/($A$1:$A10="") on rows numbers from $A$1 to current one. Criteria returns an error for all blank cells (which will be ignored) and 1 (=1/TRUE) for all non-blank cells. We multiply on cell's row numbers and return the largest one, in our case 10. IFERROR is needed for the beginning of the first range which starts from A1.
Now as result we have INDEX(A:A,10), or 10th cell in the column A, or A10.
Within MATCH the INDEX(--(A10:A$1048576=""),0) returns an array with TRUE for each blank cell in the range starting from A10 till end of the column and FALSE otherwise, double dash converts them to 1 and 0. MATCH find position of the first number 1 (1st parameter) in this array, other words position of the first blank cell, in our case that will be 6. Minus 1 gives position of last non-blank cell (5).
Thus second INDEX will be INDEX(A10:A$1048576,5) which returns 5th cell in above range, or A14.
As result INDEX(...):INDEX() will be equivalent of A10:A14 and we apply MAX to that range.
- SergeiBaklanApr 25, 2019Diamond Contributor
Twifoo , thank you
- TwifooApr 25, 2019Silver ContributorNice explanation!