Let's say in A1 I have the number 500 and in A45 I have the number 323.
How do fill cells A2->A44 with numbers that evenly reduce down to the end number of 323 (A45)?
CodePudding user response:
- go to File
- select Spreadsheet settings
- choose Calculation
- and turn on Iterative calculation
- then use this formula:
=ARRAYFORMULA(INDIRECT("A"&
MAX(IF(A3:A<>"", ROW(A3:A), ))) SORT(ROW(INDIRECT("A1:A"&
MAX(IF(A3:A<>"", ROW(A3:A), ))-2)), 1, 0)*(A1-INDIRECT("A"&
MAX(IF(A3:A<>"", ROW(A3:A), ))))/(
MAX(IF(A3:A<>"", ROW(A3:A), ))-1))
CodePudding user response:
To get the step, find the difference between A1
and A45
and divide that by the number of rows between the two cells plus 1.
Then multiply the step by the sequence 1, 2, 3... N where N is the number of rows between the two cells, and subtract the product from A1
, like this:
=arrayformula( round( A1 - sequence(rows(A2:A44)) * ((A1 - A45) / (rows(A2:A44) 1) ) ) )