# Add B1:B5 if enter 5; B1:B7 if enter 7

#### skittles96

##### Board Regular
Column A Column B
Jan 11584
Feb 11020
Mar 7577
Apr 8961
May 7040
Jun 4591
Jul 3809
Aug 4759
Sep 4736
Oct 8995
Nov 8120
Dec 11728

I'd like to create formula in column D that if I enter a "5" in C1, it SUMS B1:B5; if I enter a 7, I'd like it to SUM b1:b7 and so on.

Any thoughts.

Thanks in advance for your assistance !

### Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
=if(c1=5, sum(b1:b5),if(c1=7,sum(b1:b7),0)

Try

=SUM(B1:INDEX(B:B,C1))

Assuming data starts in B2
Code:
``=SUM(INDIRECT("B2:B"&C2+1))``
lenze

This worked perfectly... thanks !!

=SUM(B1:INDEX(B:B,C1))

Replies
22
Views
568
Replies
2
Views
470
Replies
3
Views
155
Replies
0
Views
122
Replies
5
Views
200

1,196,053
Messages
6,013,119
Members
441,749
Latest member
batel19

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

### Which adblocker are you using?

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

### Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back