Sum variable range

SimonHughes

Active Member
Joined
Sep 16, 2009
Messages
386
Hello, I would like to sum values in column A depending if I want o sum the top 10 or 20 etc. There would be an input cell, C2 where you could enter 10 and then the first 10 values in column A would be added, changing the input cell to 15 would add the top 15 values and so on. Any help appreciated. Data would start in cell A2. I am using Excel 2010
 

Some videos you may like

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

jamcall

Active Member
Joined
Sep 19, 2013
Messages
287
This should work for you:
=SUM(INDIRECT("A2:A" & C2 + 1))

HTH,
~ Jim
 

SimonHughes

Active Member
Joined
Sep 16, 2009
Messages
386
Hi All, I meant the highest values Davey. The formula from Brian is not working (may be a cell reference thing??) but the one from Jamcall is. Many thanks for taking the time to reply and help out appreciated.
 

jamcall

Active Member
Joined
Sep 19, 2013
Messages
287
Hi All, I meant the highest values Davey. The formula from Brian is not working (may be a cell reference thing??) but the one from Jamcall is. Many thanks for taking the time to reply and help out appreciated.

Glad it helped... That works if your data is sorted (hi to lo). If you just wanted highest values without sorting (as I think Davey was alluding to) you could use something like:

{=SUM(LARGE(A:A,ROW(INDIRECT("A1:A"&C2))))}

- array formula, enter with Ctrl-Shift-Enter

You could adjust A:A to fit the range of your data as needed.

Cheers,
~ Jim
 

Watch MrExcel Video

Forum statistics

Threads
1,123,144
Messages
5,599,978
Members
414,354
Latest member
Flaxarn

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?

Disable AdBlock

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
Top