ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dynamic Sum (https://www.excelbanter.com/excel-programming/386944-dynamic-sum.html)

Steve[_4_]

Dynamic Sum
 
Hello. I have 5 sheets (named Sheet1 though Sheet5). On an input
sheet, I wrote sheet1 though sheet5 in cells A2:A6, with a 1 or 0 in
column B. Is there a way sum cell A1 in each of the sheets that have
a 1 next to it in column B?


Jim Rech

Dynamic Sum
 
Multiply each of the A1's times its corresponding cell in column B.

--
Jim
"Steve" wrote in message
ups.com...
| Hello. I have 5 sheets (named Sheet1 though Sheet5). On an input
| sheet, I wrote sheet1 though sheet5 in cells A2:A6, with a 1 or 0 in
| column B. Is there a way sum cell A1 in each of the sheets that have
| a 1 next to it in column B?
|



Steve[_4_]

Dynamic Sum
 
On Apr 5, 4:41 pm, "Jim Rech" wrote:
Multiply each of the A1's times its corresponding cell in column B.

--
Jim"Steve" wrote in message

ups.com...
| Hello. I have 5 sheets (named Sheet1 though Sheet5). On an input
| sheet, I wrote sheet1 though sheet5 in cells A2:A6, with a 1 or 0 in
| column B. Is there a way sum cell A1 in each of the sheets that have
| a 1 next to it in column B?
|


Thanks Jim. But I oversimplified the question dramatically. Its more
like I need to sum cells A1:AC457 based on whether or not the sheet in
the Input section has a 1 or zero next to it. Also, there are MANY
more than 5 sheets. Is there something that can be done with named
ranges?


Jim Rech

Dynamic Sum
 
Maybe my brain isn't firing on all cyclinders today but I cannot envision a
practical way to do what you want via formulas or named ranges.

The only thing that does come to mind requires a macro to make it practical
and even then it's a little kludgey.

Presumably you have summing formulas like this: =SUM(Sheet1:Sheet10!A1).
This sums the values in cell A1 for all the sheets that fall between Sheet1
and Sheet10 inclusive. If you didn't want, say, Sheet9 to be included, you
could move to after Sheet10.

Since you'd probably want to be able in exclude Sheet1 and Sheet10 you would
need to have two dummy sheets that came before the first and after the last:
=SUM(BeforeFirstSheet:AfterLastSheet!A1).

A macro could go through all your 0's and 1's and move the sheets as needed.

Like I said, a little kludgey.<g
--
Jim
"Steve" wrote in message
ups.com...
On Apr 5, 4:41 pm, "Jim Rech" wrote:
Multiply each of the A1's times its corresponding cell in column B.

--
Jim"Steve" wrote in message

ups.com...
| Hello. I have 5 sheets (named Sheet1 though Sheet5). On an input
| sheet, I wrote sheet1 though sheet5 in cells A2:A6, with a 1 or 0 in
| column B. Is there a way sum cell A1 in each of the sheets that have
| a 1 next to it in column B?
|


Thanks Jim. But I oversimplified the question dramatically. Its more
like I need to sum cells A1:AC457 based on whether or not the sheet in
the Input section has a 1 or zero next to it. Also, there are MANY
more than 5 sheets. Is there something that can be done with named
ranges?




All times are GMT +1. The time now is 10:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com