if formula

G

Guest

I have a worksheet with 13 columns (Column A to M) for all the months of
year plus the accumulated or Year to date total column. A formula should add
the accumulated for each month of the year in the 13th column. Example if I
input "3" in cell A1 it should automatically sum at cell M2 all three cells
for months of Jan, Feb and March or (A2,B2,C2) and if I entred "5" for months
of Jan to May and etc.

As example below if I entered "3" in cell A1, the accumulated column should
show "35". Calculated 10+15+10 for jan,feb and march figures.

A B C D .... L M
"3"
Jan Feb Mar Apr... Dec Total Accumulated/YTD
10 15 10 20 ... 12 = 35

Appreciate for your help!
 
G

Guest

You can use choose

sum(a1,a5,a5:b5,a5:c5,a5:d5,a5:e5,a5:f5,a5:g5,a5:h5,a5:i5,a5:j5,a5:k5,a5:l5))

a1 is an index and will choose a differnt range of cell depending if the
number in a1 is from 1 to 12
 
D

Dave Peterson

One more:
=SUM(A3:OFFSET(A3,0,0,1,$A$1))




I have a worksheet with 13 columns (Column A to M) for all the months of
year plus the accumulated or Year to date total column. A formula should add
the accumulated for each month of the year in the 13th column. Example if I
input "3" in cell A1 it should automatically sum at cell M2 all three cells
for months of Jan, Feb and March or (A2,B2,C2) and if I entred "5" for months
of Jan to May and etc.

As example below if I entered "3" in cell A1, the accumulated column should
show "35". Calculated 10+15+10 for jan,feb and march figures.

A B C D .... L M
"3"
Jan Feb Mar Apr... Dec Total Accumulated/YTD
10 15 10 20 ... 12 = 35

Appreciate for your help!
 
G

Guest

think you left the choose function out of your answer


=SUM(A5:CHOOSE($A$1,A5,B5,C5,D5,E5,F5,G5,H5,I5,J5,K5,L5))
 
G

Guest

Below formula is working perfectly.
Thanks for sharing your knowledge! You all helping us great!

I have another query, I have a worksheet that requires the same computation
but with extra column inserted in between the months and with corresponding
data on it. That is two columns each month. but I have to include only one
column and exclude the other in my formula. Using the same formula did not
make correct results, as it also computed the data in the extra column that I
inserted which is not a part of the computation.

Thanks in advance!
 

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