Maybe something like this...
Data Range
A B C D 1 Data ----- Number of cells Sum 2 1 5 5 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1
This formula entered in D2:
=SUM(A2:INDEX(A2:A11,C2))
If C2 is an empty cell the formula will sum the entire range.
Bookmarks