Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Lram
 
Posts: n/a
Default Summing every nth row value based upon variable


In a Budget/Actual spreadsheet I would like to be able to sum the
monthly budget values in a year-to-date cell that corresponds to the
number of months of the year that have elapsed. I use a Name value
"Month" in a cell that represents "year-to-date-thru".

I have tried to accomplish this by using a nested IF statement the
matches the "Month" with a string of (+) to sum the values from the
appropriate cells, i.e., +F12+I12+L12 for the "Mar" entry. This
obviously creates a very long nested IF which seems to fail if I go
beyond the 9th nest or "Sep".

Is there a better way to do this? Is there an upper limit on the
number of nested IFs?

Thanks,

Lram


--
Lram


------------------------------------------------------------------------
Lram's Profile: http://www.excelforum.com/member.php...nfo&userid=238
View this thread: http://www.excelforum.com/showthread...hreadid=528887

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default Summing every nth row value based upon variable

Try this

=SUMPRODUCT(--(MOD(COLUMN(F12:O12),3)=0),F12:O12)

The 3 after the mod is where you would add your month number. Also extend
beyond O12 as far as is needed.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Lram" wrote in message
...

In a Budget/Actual spreadsheet I would like to be able to sum the
monthly budget values in a year-to-date cell that corresponds to the
number of months of the year that have elapsed. I use a Name value
"Month" in a cell that represents "year-to-date-thru".

I have tried to accomplish this by using a nested IF statement the
matches the "Month" with a string of (+) to sum the values from the
appropriate cells, i.e., +F12+I12+L12 for the "Mar" entry. This
obviously creates a very long nested IF which seems to fail if I go
beyond the 9th nest or "Sep".

Is there a better way to do this? Is there an upper limit on the
number of nested IFs?

Thanks,

Lram


--
Lram


------------------------------------------------------------------------
Lram's Profile:

http://www.excelforum.com/member.php...nfo&userid=238
View this thread: http://www.excelforum.com/showthread...hreadid=528887



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JMB
 
Posts: n/a
Default Summing every nth row value based upon variable

Currently, I believe Excel nests to 7 levels

"Lram" wrote:


In a Budget/Actual spreadsheet I would like to be able to sum the
monthly budget values in a year-to-date cell that corresponds to the
number of months of the year that have elapsed. I use a Name value
"Month" in a cell that represents "year-to-date-thru".

I have tried to accomplish this by using a nested IF statement the
matches the "Month" with a string of (+) to sum the values from the
appropriate cells, i.e., +F12+I12+L12 for the "Mar" entry. This
obviously creates a very long nested IF which seems to fail if I go
beyond the 9th nest or "Sep".

Is there a better way to do this? Is there an upper limit on the
number of nested IFs?

Thanks,

Lram


--
Lram


------------------------------------------------------------------------
Lram's Profile: http://www.excelforum.com/member.php...nfo&userid=238
View this thread: http://www.excelforum.com/showthread...hreadid=528887


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mikeopolo
 
Posts: n/a
Default Summing every nth row value based upon variable


Another way:

With my headings in row 2, and data in row 3, columns A to L, and a
column letter (a thru l) in cell M1, in cell M3, for the YTD total,
type:

=SUM(INDIRECT("A3:"&M1&"3"))

This will resolve to =sum(A3:X3) where x is the letter you type in M1.


I came up with this a long time before I learned about sumproduct,
which gives a more elegant solution.

Regards
Mike


--
Mikeopolo
------------------------------------------------------------------------
Mikeopolo's Profile: http://www.excelforum.com/member.php...o&userid=18570
View this thread: http://www.excelforum.com/showthread...hreadid=528887

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default Summing every nth row value based upon variable

Apart from the fact that this sums all values between say F12 and L12, where
the OP only wants every 3rd column (at least in the example), it does have
the limitation of being volatile. Maybe a problem, maybe not, but it is a
consideration.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Mikeopolo" wrote
in message ...

Another way:

With my headings in row 2, and data in row 3, columns A to L, and a
column letter (a thru l) in cell M1, in cell M3, for the YTD total,
type:

=SUM(INDIRECT("A3:"&M1&"3"))

This will resolve to =sum(A3:X3) where x is the letter you type in M1.


I came up with this a long time before I learned about sumproduct,
which gives a more elegant solution.

Regards
Mike


--
Mikeopolo
------------------------------------------------------------------------
Mikeopolo's Profile:

http://www.excelforum.com/member.php...o&userid=18570
View this thread: http://www.excelforum.com/showthread...hreadid=528887



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Aling multiple sets of data by header column MarkusO Excel Discussion (Misc queries) 2 April 12th 06 07:29 PM
Sum cells based on a row variable and seperate column variable CheeseHeadTransplant Excel Worksheet Functions 10 September 23rd 05 06:59 PM
Linking a cell to another workbook cell based on a variable name Brian Excel Discussion (Misc queries) 6 June 1st 05 11:54 PM
How can I assign a range starting cell based on a variable locati. feman007 Excel Discussion (Misc queries) 1 March 9th 05 11:41 PM
How can I assign a range starting cell based on a variable locati. feman007 Excel Worksheet Functions 3 March 9th 05 11:40 PM


All times are GMT +1. The time now is 03:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"