Nested If Statements

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

Hoping someone can help.

I have a sheet that has 12 months of data going across 12 columns. Each
column has a heading for each month i.e 1, 2 ,3 ... There are multiple rows
of data. I need a formula that will sum the columns of data based on the
month that is entered in cell A1. For example, if I enter 5 in cell A1, I
want the YTD formula to add up only the first 5 months of data.

Thanks in advance for any help.
 
My worksheet has 1,2,,3...12 in B1:M1
In the 20 rows below I have data
In A1 I enter a number, say 5
In A2 I have =SUMPRODUCT((B1:M1<=A1)*B2:M21)
This sum all the data for the columns having number 1 thru 5 in row 1
best wishes
 
That worked great for summing up all the data in the range.

One more question. I also need to have a total for each row of data. What
formula would I need to use on each row to total each row based on the month
keyed into cell A1?
 
Hoping someone can help.

I have a sheet that has 12 months of data going across 12 columns. Each
column has a heading for each month i.e 1, 2 ,3 ... There are multiple rows
of data. I need a formula that will sum the columns of data based on the
month that is entered in cell A1. For example, if I enter 5 in cell A1, I
want the YTD formula to add up only the first 5 months of data.

Thanks in advance for any help.


I assume you want to sum everything that is in one row:

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

Change B2 to the cell that has the data for January in the row of choice.

--ron
 
Thanks Ron,

Works like a charm



Ron Rosenfeld said:
I assume you want to sum everything that is in one row:

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

Change B2 to the cell that has the data for January in the row of choice.

--ron
.
 
Back
Top