google-sheetsarray-formulascircular-reference

Calculate a value using previous cell in same column with arrayformula or byrow in Google Sheets - is it possible?


I have a very simple formula for calculating portfolio value in Google Sheets that I'd like to automate (so the calculation fills automatically as new lines are added), but I can't seem to find a way to reference a previous cell in the same column using arrayformula or byrow. I keep getting a circular reference (which I understand) but just can't seem to find a workaround. Can anyone help, or perhaps put me out of my misery by letting me know it's just not possible (because of the way arrays & byrow work). Or, if there is another way?

Here's the data ($100,000 is in first value entered into cell B1, calculations are done in subsequent cells B2,B3,B4 etc...):

enter image description here

Appreciate any and all help!


Solution

  • Use SCAN:

    =SCAN(B1,A2:A5,LAMBDA(a,c,a*(1+c)))