How do I put a variable column number in the sum() function?

B

BobC

I want to sum cells based on a number contained in cell A1
For example:
I currently have the formula =SUM(F7:I7) which sums 4 of the cells in
row 7 (form F to I).
I would like to be able to have the number of cells in row 7 determined
by a value in a specific cell such as cell A1 (in this example would
have contained the number 4).

I do not seem to be able to functions of any kind in the range sum
expression?
 
S

Shane Devenshire

Hi,

The following formula should do the trick

=SUM(OFFSET(F7,,,,A1))

If this helps, please click the Yes button

Cheers,
Shane Devenshire
 
T

T. Valko

Here's a non-volatile method:

=SUM(F7:INDEX(F7:IV7,A1))

If A1 is empty the formula will calculate the entire range.
 
S

Shane Devenshire

Hi,

The button is over on the right and has the comment Was this post helpful to
you?

But you wouldn't be the first person to miss it, and it may not even display
that way in some browsers.

Cheers,
Shane
 
D

David Biddulph

Bob is probably not using Microsoft's web interface to the newsgroup, so if
he is accessing the newsgroup directly (as many of us do) he wouldn't see
the button.
 
B

BobC

Thanks!!!
I appreciate the help!
Everything that I was trying seemed to yield syntax errors!

Bob
 
B

BobC

Shane,

No buttons shows.
I thought you were just being funny.
I'm using Mozilla (SeaMonkey).
You'll have to press the button in my behalf.
Thanks again! ... it worked!

Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top