ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Sum of an array (https://www.excelbanter.com/excel-worksheet-functions/208319-sum-array.html)

[email protected]

Sum of an array
 
Is there anyway to sum a range of values given a specific number of
cells you choose to sum. For example you have a range from A1:F1,
G1=number of cells you want to sum from left to right, and H1 is the
total. So if G1=3, then H1=sum(A1:C1) or 16. If G1=5, then
H1=sum(A1:E1) or 20.


A B C D E F G H

1 3 5 8 3 1 7 Var Sum

Thanks in advance.

Bernie Deitrick

Sum of an array
 
In H1,

=SUM(OFFSET(A1,,,1,G1))

HTH,
Bernie
MS Excel MVP


wrote in message
...
Is there anyway to sum a range of values given a specific number of
cells you choose to sum. For example you have a range from A1:F1,
G1=number of cells you want to sum from left to right, and H1 is the
total. So if G1=3, then H1=sum(A1:C1) or 16. If G1=5, then
H1=sum(A1:E1) or 20.


A B C D E F G H

1 3 5 8 3 1 7 Var Sum

Thanks in advance.




RagDyeR

Sum of an array
 
Non-volatile approach:

=SUM(A1:INDEX(A1:F1,G1))

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------


wrote in message
...
Is there anyway to sum a range of values given a specific number of
cells you choose to sum. For example you have a range from A1:F1,
G1=number of cells you want to sum from left to right, and H1 is the
total. So if G1=3, then H1=sum(A1:C1) or 16. If G1=5, then
H1=sum(A1:E1) or 20.


A B C D E F G H

1 3 5 8 3 1 7 Var Sum

Thanks in advance.



[email protected]

Sum of an array
 
On Oct 29, 7:04*pm, "Ragdyer" wrote:
Non-volatile approach:

=SUM(A1:INDEX(A1:F1,G1))

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------

wrote in message

...

Is there anyway to sum a range of values given a specific number of
cells you choose to sum. *For example you have a range from A1:F1,
G1=number of cells you want to sum from left to right, and H1 is the
total. *So if G1=3, then H1=sum(A1:C1) or 16. *If G1=5, then
H1=sum(A1:E1) or 20.


A B C D E F G H


1 3 5 8 3 1 7 Var Sum


Thanks in advance.


Perfect! Thanks a bunch!

RagDyeR

Sum of an array
 
You're welcome, and appreciate the feed-back.
--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
wrote in message
...
On Oct 29, 7:04 pm, "Ragdyer" wrote:
Non-volatile approach:

=SUM(A1:INDEX(A1:F1,G1))

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------

wrote in message

...

Is there anyway to sum a range of values given a specific number of
cells you choose to sum. For example you have a range from A1:F1,
G1=number of cells you want to sum from left to right, and H1 is the
total. So if G1=3, then H1=sum(A1:C1) or 16. If G1=5, then
H1=sum(A1:E1) or 20.


A B C D E F G H


1 3 5 8 3 1 7 Var Sum


Thanks in advance.


Perfect! Thanks a bunch!




All times are GMT +1. The time now is 01:26 PM.

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