There is a worksheet function in Microsoft Excel that can be used. Below formula will fetch you the desired results:
Follow the step by step instructions mentioned below to use the above formula:
1. Enter the values 1, 2, 3 ... in the cells from A1 to A10.
2. Enter the other set of values 34, 22, 12 ... in the cells from B1 to B10.
3. Enter the labels in the cells as mentioned below:
C1 - Range Start
D1 - Range End
E1 - Range Sum
4. In E2 enter the above Formula.
5. If your range starts at A1 and ends at A5, enter 1 in C2 and 5 in D2, your desired result will be displayed in E2.
You can read more about this formula from the following link:
Please revert for clarification.