Dynamic subtraction in Google Spreadsheet

拥有回忆 提交于 2019-12-13 03:58:01

问题


Please have a look at my spreadsheet: https://docs.google.com/spreadsheets/d/1K5Btg5fFS590G7vZsFiepY-2VTPhzJIlkKK_o-9Ag7E/edit?usp=sharing

How do I get:

  • C2 to show Start weight (i.e. "100,0")
  • C3 to show C2 - Daily weightloss (i.e. "99,7701")
  • C4 to show C3 - Daily weightloss (i.e. "99,5402)
  • C5 to show C4 - Daily weightloss (i.e. "99,3103")
  • ...and so on.

The challenge is obviously to do this dynamically since all the user-submitted data, and consequently, all the calculated data might change.

I think this can/should be solved with ArrayFormula somehow but I don't know how.


回答1:


=ARRAYFORMULA(IF(A2:A;
 MMULT(TRANSPOSE((ROW(INDIRECT("B2:B"&COUNTA(A1:A)))<=
       TRANSPOSE( ROW(INDIRECT("B2:B"&COUNTA(A1:A)))))*
      {B2; TRANSPOSE(SPLIT(REPT(J5*-1&"♦"; COUNTA(A3:A)); "♦"))}); 
 SIGN({B2; TRANSPOSE(SPLIT(REPT(J5*-1&"♦"; COUNTA(A3:A)); "♦"))})^2); IFERROR(1/0)))




回答2:


It looks as if you could do this

=ArrayFormula(if(A2:A="","",100-(row(A2:A)-row())*J5))

although it's not dynamic in the sense of calculating from the previous row.



来源:https://stackoverflow.com/questions/55526175/dynamic-subtraction-in-google-spreadsheet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!