Two things. i dont think i mention this, but the cell with the formula cannot
be moved. Just the data in column A. Also, if the data in column A is moved
when is sorted and the formula is reflecting the same cells. Then that feats
the whole purpose that i am referring to. What i need is that if the data in
columns is moved around than the formula changes to to reflect the same
values. But the formula does not move it will stay in the same cell. Example
below.
Before After
| A | B | C | D | E | F | E | G | H
1.| 5 5
2.| 30 8
3.| 54 A2+A5+A7 30 =F3+F5+F6
4.| 8 54
5.| 58 58
6.| 548 70
7.| 70 548
Before sorting you will need a column of consecutive numbers,
corresponding to the row numbers, next to column A (ie row numbers in
a column inserted between columns A and B).
One way of doing this is to type the row number in the column B cells
next to the first and second column A values, select both those column
B cells, then fill down to be level with the bottom of the column A
values.
Before sorting, select column A and the new column B.
After the sort, the values in column B will act as labels for keeping
track of the values used in the sum formula.
You won't be able to use your original sum formulas, which should now
be in column C, you will need to use a sum formula that is capable of
finding the intended column A values amongst the sorted column A
values.
Using your formula =A2+A5+A7 (originally in B3) as an example, a
suitable sum formula that could use the column B labels to hunt down
the intended column A values could be...
=SUM(SUMIF(B1:B7,{2,5,7},A1:A7))
Notice the 2, 5 and 7 in braces (Shift + the 2 keys to the right of
the P key) correspond to the same numbers in your original formula
that could not keep track of the sorted column A values.
This formula sums the column A values that were in rows 2, 5, and 7
before column A and the new column B were sorted using column A as the
Index column.
Ken Johnson