PDA

View Full Version : Summing last two entries or smallest two entries in a list



N3K
02-11-2007, 11:21 PM
I m doing a huffman program. I need to sum last two entries in a list.
For example,

1
2
3
4

3+4 = 7 and put '7' on top of the list because '7' bigger than '1'

becomes

7
2
1

and so...

Anyone please help me...: pray2:

Bob Phillips
02-12-2007, 02:39 AM
To get 7:

=SUM(OFFSET(A1,COUNT(A:A)-2,0,2,1))

The rest

=IF(NOT(ISERROR(LARGE(A:A,ROW(A3)))),LARGE(A:A,ROW(A3)),"")

and copy down