Formula to sum

dbrasel

Board Regular
Joined
Feb 25, 2005
Messages
88
I'm working on a formula that will sum certain cells on one spreadsheet based on a value in a different cell on a different spreadsheet. the formula below is what I've come up with so far:

=IF('Table of Contents'!F1=1,SUM(Roseville!E26:E26),IF('Table of Contents'!$F$1=2,SUM(Roseville!E26:F26)))

as I will need a total of 12 if's (F1 =1, F1 = 2 all the way to F1=12,SUM (Roseville!E26:P26), I was wondering if there were a neater way of creating this formula. I have Excel 2007.

as always, thanks for the help!


Deb
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I would look at INDIRECT for this. You can use it to concatenate text and numbers, based on entries in other cells, to form a reference to your required range

e.g.
Code:
=SUM(INDIRECT("A"&B1&":A"&C1))
will sum all cells in column A, between row [value in B1] and row [value in C1]

Use this approach, along with a formula that changes the Letter as you want too (e.g. based on a VLOOKUP), and it should do what you want
 
Upvote 0
Add the remaining 8 references the Roseville!$E26:P26))

Code:
=CHOOSE('Table of Contents'!F1,SUM(Roseville!$E26:E26),SUM(Roseville!$E26:F26),SUM(Roseville!$E26:G26),SUM(Roseville!$E26:H26))
 
Upvote 0
Perhaps:

=SUM(INDIRECT("E26:"&ADDRESS(26,5+'Table of Contents'!$F$1))
 
Upvote 0
thank you for such a quick response! I went with delaneyjm's answer, it works like a champ! this board is awesome, I really appreciate the help!

Deb
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,181
Members
452,893
Latest member
denay

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
Back
Top