View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove Harlan Grove is offline
external usenet poster
 
Posts: 733
Default "Slope" and "intercept" function help

Bernie Deitrick wrote...
No. The two arguments for each function must be contiguous blocks of cells, though the
two blocks don't need to be near each other.

....

The arguments could be arrays, and arrays can be constructed from
nonadjacent cells.

Brute force:

A2*{1;0;0;0;0;0;0;0;0;0;0;0}+B4*{0;1;0;0;0;0;0;0;0 ;0;0;0}+C6*{0;0;1;0;0;0;0;0;0;0;0;0}
+D8*{0;0;0;1;0;0;0;0;0;0;0;0}+E10*{0;0;0;0;1;0;0;0 ;0;0;0;0}+F12*{0;0;0;0;0;1;0;0;0;0;0;0}
+G14*{0;0;0;0;0;0;1;0;0;0;0;0}+H16*{0;0;0;0;0;0;0; 1;0;0;0;0}+I18*{0;0;0;0;0;0;0;0;1;0;0;0}
+J20*{0;0;0;0;0;0;0;0;0;1;0;0}+K22*{0;0;0;0;0;0;0; 0;0;0;1;0}+L24*{0;0;0;0;0;0;0;0;0;0;0;1}

Same more compactly using the name seq defined as
={1;2;3;4;5;6;7;8;9;10;11;12}

A2*(seq=1)+B4*(seq=2)+C6*(seq=3)+D8*(seq=4)+E10*(s eq=5)+F12*(seq=6)
+G14*(seq=7)+H16*(seq=8)+I18*(seq=9)+J20*(seq=10)+ K22*(seq=11)+L24*(seq=12)

Same more compactly still but using the volatile OFFSET function

N(OFFSET(A2,2*(ROW(A1:A12)-1),ROW(A1:A12)-1,1,1))