问题
I am doing a ledger for accounting purposes. I have it set up like a checkbook registry. It has 4 columns: Date, Description, Amount and Balance. The formula set up in the last column (Balance) is set up to add the number in the "Amount" column to the balance in the last line entry. The formula is copied down the page in the last column. What I would like to do, is only have a number in that column if there is an entry on that line. Here is my question: Is there a way to hide the number in the last column until there is an entry on that line? What I would like is for the additional entries of $15 to remain hidden until there is a value in the "Amount" column on that particular row.
I hope this all makes sense! I'm at a loss! Any help is appreciated :)
回答1:
simple and slow:
=INDEX(IF(C2:C="",, MMULT(
TRANSPOSE((ROW(C2:C)<=
TRANSPOSE( ROW(C2:C)))*C2:C), ROW(C2:C)^0)))
simple and short with medium speed:
=INDEX(IF(C2:C="",,SUMIF(ROW(C2:C), "<="&ROW(C2:C), C2:C)))
advanced and fast:
=ARRAYFORMULA(MMULT(
TRANSPOSE((ROW(INDIRECT("C2:C"&MAX(ROW(C:C)*(C:C<>""))))<=
TRANSPOSE( ROW(INDIRECT("C2:C"&MAX(ROW(C:C)*(C:C<>""))))))*
INDIRECT("C2:C"&MAX(ROW(C:C)*(C:C<>"")))),
QUERY(INDIRECT("C2:C"&MAX(ROW(C:C)*(C:C<>""))),
"select 1 label 1''")))
来源:https://stackoverflow.com/questions/65545241/google-sheets-cell-info