I currently have the following formula:
=SUMIF($Sheet2.$A2:$A32, TEXTJOIN("|", 1, $Sheet1.N2:N42), $Sheet2.$G2:$G32)
I need to use a variation of this formula (or more complicated ones that follow the same general idea) multiple times for different ranges. So I’ll start with rows 2-32, but then want to have a different one for rows 33-57 and again for 58-65, etc.
I’d like to create a variable for the values “2” and “32” in the example formula above so every time I need to modify it, I can just update “2” and “32” to the new values in one place instead of manually scanning with my eyes for every correct instance of “2” and “32” in the formula. Is there a way for me to do this?
During my searches, I found the INDIRECT function. I can get it to work with the “32” value in the example above by putting “32” in cell Q10 and using the formula:
=SUMIF($Sheet2.$A2:INDIRECT("A" & Q10), TEXTJOIN("|", 1, $Sheet1.N2:N42), $Sheet2.$G2:INDIRECT("G" & Q10))
The problem is, as soon as I try that for “2”, the cell gets the error “#NAME?” and the formula becomes
=SUMIF($sheet2.indirect("A" & Q9):INDIRECT("A" & Q10), TEXTJOIN("|", 1, $Sheet1.N2:N42), $Sheet2.$G2:INDIRECT("G" & Q10))
As far as I can tell, LibreOffice considers “indirect” to be a literal string rather than a function name, and so the cell reference of course becomes invalid. Is there some kind of syntax I can use to indicate otherwise?