I have a column B which may have a value 1 or is empty.I want to calculate 2 fields: startFirstRange: the start rownumber of the first non-empty range, or -1 if not exist.endFirstRange: the end rownumber of the first non-empty range, or 0 if not exist.I've managed to get startFirstRange as follows:  =ArrayFormula(MIN(IFERROR(FILTER(ROW(Sheet1!B2:B),NOT(ISBLANK(Sheet1!B2:B))),-1)))Naively, I tried the following to get endFirstRange: =ArrayFormula(MAX(FILTER(ROW(Sheet1!B:B),NOT(ISBLANK(Sheet1!B:B)))))However, this results in the end rownumber of the last non-empty range, instead of the end rownumber of the first non-empty range. How to proceed?
Google spreadsheet: calculate start and end rownumber of first non-empty range
google spreadsheets
My attempt (there may well be a shorter way):For startFirstRange, lets say invoked in A1:=INDEX(IFERROR(FILTER(ROW(Sheet1!B2:B),NOT(ISBLANK(Sheet1!B2:B))),-1),1)Then for endFirstRange, which will reference the result of startFirstRange in A1:=IF(A1=-1,0,IFERROR(INDEX(FILTER(ROW(Sheet1!B2:B)-1,ROW(Sheet1!B2:B)>A1,ISBLANK(Sheet1!B2:B)),1),ROWS(Sheet1!B:B)))