Are there any formula experts here?
I'm trying to append a total row to a QUERY formula with a pivot. It's complicated but the actual formula works B"H, I just need help with the total row. I'm using {} to append the row.
The total row has to do some subtraction, so I'm putting in there SUMIF based on the data that's somewhere else. The SUMIF works great if I manually type in the column letter for each column. Looking for a better way, I thought I could use the COLUMN() function. Problem: the COLUMN() function seems to refer to the column in which the function is placed, not the column where the result is displayed.
For testing purposes I put this in column I, and got this result:
={column(),column()}
9 9
Anyone know of a way around this? I want the second 9 which is displayed in column J to show a 10.
Here's my entire function/formula in case you need it, but the question stands even without it:
={QUERY(Subsidies!A:F,"SELECT E, SUM(D) WHERE B <> '' group by E pivot(F) ORDER BY E DESC");"TOTAL DUE",-(sumif(A:A,"Deposit",INDIRECT("C"&COLUMN()-7,false))-sumif(A:A,"Trip Subsidy",C:C)),-(sumif(A:A,"Deposit",INDIRECT("C"&COLUMN()-7,false))-sumif(A:A,"Trip Subsidy",C:C)),-(sumif(A:A,"Deposit",INDIRECT("C"&COLUMN()-7,false))-sumif(A:A,"Trip Subsidy",C:C))}
TIA!!