# Pushing a 'slider' to the limit

#### naquinn

##### Board Regular
Hello everyone,

I have a question about sliders.

I have a column with different values in it, all numbers. I have a separate cell that calculates a range within that column. Say for example, =Average(A1:A12)

Ok, my question is, can I design some sort of 'slider' that expands or contracts the range that this simple average formula is looking at? So by moving the slider a number of clicks, the formula suddenly becomes =Average(A1:A20)

My head hurts from trying to work this one out. Someone, said it might be possible with VBA? But no idea what this means.

Anyway, help, solutions, or pointers in the right direction would be very very gratefully received!

Many thanks to you all!

nick (london)

### Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use \$ signs: \$V\$2:\$Z\$99 will always point to V2:Z99, even after copying

#### tusharm

##### MrExcel MVP
From the Forms toolbar insert a scrollbar onto the worksheet surface.

Right click the control and select Format Control... Set the linked cell to a cell that will contain the row number of the last cell of interest. I chose B3. In B2, I entered 1, the row number of the first cell of interest.

Then, in some cell enter the formula =AVERAGE(INDIRECT("A"&B2&":A"&B3))

That's it. You are done.

Right click the control and select Format Control... to adjust the different parameters. I'd set the min. value to 1 (rather than the default 0) and the max. value to whatever is appropriate to your model.

#### naquinn

##### Board Regular
Wow! Thankyou!

A simple and elegant solution.

Many many thanks!

nick

You are welcome.

Replies
3
Views
152
Replies
22
Views
763
Replies
2
Views
254
Replies
6
Views
401
Replies
1
Views
2K

1,191,719
Messages
5,988,292
Members
440,148
Latest member
sandy123

### 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.

### Which adblocker are you using?

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

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