ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   if formula (https://www.excelbanter.com/excel-discussion-misc-queries/131405-if-formula.html)

Rechie

if formula
 
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!



joel

if formula
 
You can use choose

sum(a1,a5,a5:b5,a5:c5,a5:d5,a5:e5,a5:f5,a5:g5,a5:h 5,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

"Rechie" wrote:

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!



Dave Peterson

if formula
 
One mo
=SUM(A3:OFFSET(A3,0,0,1,$A$1))





Rechie wrote:

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!


--

Dave Peterson

Tom Ogilvy

if formula
 
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))

--
Regards,
Tom Ogilvy


"Joel" wrote:

You can use choose

sum(a1,a5,a5:b5,a5:c5,a5:d5,a5:e5,a5:f5,a5:g5,a5:h 5,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

"Rechie" wrote:

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!



Rechie

if formula
 
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!



"Tom Ogilvy" wrote:

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))

--
Regards,
Tom Ogilvy


"Joel" wrote:

You can use choose

sum(a1,a5,a5:b5,a5:c5,a5:d5,a5:e5,a5:f5,a5:g5,a5:h 5,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

"Rechie" wrote:

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!




All times are GMT +1. The time now is 05:48 AM.

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