SUM Columns via INDIRECT formula

mabbott

New Member
Joined
Jul 22, 2010
Messages
4
Hi all,

I have come across this formula, INDIRECT, and think it may help me with the tedious task of returning the SUM of a column in a worksheet via a cell that names that worksheet. But for the life of me i cannot figure it out...any help would be much appreciated.

so...in sheet1 I have the name of the worksheets in cells A1 to C1, e.g A1=110121, B1=110122, C1=110123, in A2 I want the sum of column D:D in worksheet 110121 to be returned, this would also be the case for B1 & C1 but returning the value of the worksheet name above them...

I imagine that this fairly simple...but alas I cannot get my head around it!!!

Thanks in advance

Mick
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Since those are numeric values, you'll need to use the apostrophe (') around the sheetname.

To set it directly, you could use =SUM('110121'!D:D)

To use the indirect function, you could use =SUM(INDIRECT(B2&"!D:D")), so long as the value in B2 is stored as text.

If the value in B2 is stored as a number, then you can use the following to convert it to text within the formula: =SUM(INDIRECT(TEXT(C2, "General")&"!D:D"))
 
Upvote 0
Since those are numeric values, you'll need to use the apostrophe (') around the sheetname.

To set it directly, you could use =SUM('110121'!D:D)

To use the indirect function, you could use =SUM(INDIRECT(B2&"!D:D")), so long as the value in B2 is stored as text.

If the value in B2 is stored as a number, then you can use the following to convert it to text within the formula: =SUM(INDIRECT(TEXT(C2, "General")&"!D:D"))

Something I wasn't aware, I don't use numbers for sheet names, thanks for correcting my error.
 
Upvote 0
Thanks all, Andrew yes that worked perfectly...just out of interest though, what do each of the steps do, I understand the cell references but as for the "" and the & bits I am not 100% sure :) I just like to understand formulas fully before using them...
 
Upvote 0
The steps construct a reference as a string, using concatenation. If A1 contains 110121, then the reference '110121'!D:D can be written:

"'"&A1&"'!D:D"

The bits in quotes are constant and a1 is variable.
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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