#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default SumIF

I am trying to sum a certain number of columns, based on the criteria in a
certain cell.

If my criteria is an "8", I want to sum the last 8 columns of an array. If
I change the 8 to a 9, I want the sum to automatically pick up the last 9
columns,if I change it to 10, I want the sum of the last 10 columns, etc.

Can anyone help????


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 109
Default SumIF

Flanno

Try using the OFFSET function with a variable for the 3rd (vertical
array) or fourth (horizontal array) aruguments.

If you have a horizontal array starting in cell C1 and your variable
(the number to be summed) is in A1 and is is n, and you put in B1 the
following formula in B1

=SUM (OFFSET(C1,0,0,1,a1))

it will sum the FIRST n values of elements in your array.

Since you want to sum the last n values, you will need to build some
logic into one the second or third arguments of the OFFSET function.
For example, if your array is 25 items long, starting in C1 and your
variable is in A1 and your formula is in B1, then you would need
something like

=SUM(OFFSET(C1,0,25-a1,1,a1)

If your array is vertical you would need to have the variables in the
"row" arguments of the OFFSET function.

Good luck.

Ken
Norfolk, Va





On May 16, 3:33*pm, Flanno wrote:
I am trying to sum a certain number of columns, based on the criteria in a
certain cell. *

If my criteria is an "8", I want to sum the last 8 columns of an array. *If
I change the 8 to a 9, I want the sum to automatically pick up the last 9
columns,if I change it to 10, I want the sum of the last 10 columns, etc.

Can anyone help????


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default SumIF

If the range contains blanks try this array entered with CTRL+Shift+Enter

=SUM(A100:INDEX(A1:A100,LARGE(ROW(A1:A100)*(A1:A10 0<""),B1)))

where B1 contains the rows to sum

Mike

"Flanno" wrote:

I am trying to sum a certain number of columns, based on the criteria in a
certain cell.

If my criteria is an "8", I want to sum the last 8 columns of an array. If
I change the 8 to a 9, I want the sum to automatically pick up the last 9
columns,if I change it to 10, I want the sum of the last 10 columns, etc.

Can anyone help????


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
sumif for multi conditions. i.e sumif(A1:A10,"Jon" and B1:B10,"A" Harry Seymour Excel Worksheet Functions 9 June 12th 07 10:47 PM
SUMIF Help SUMIF Help Excel Discussion (Misc queries) 5 March 6th 07 04:14 PM
Embedding a Sumif in a sumif C.Pflugrath Excel Worksheet Functions 5 August 31st 05 07:31 PM
nested sumif or sumif with two criteria dshigley Excel Worksheet Functions 5 April 5th 05 03:34 AM
SUMIF - Range name to used for the "sum_range" portion of a SUMIF function Oscar Excel Worksheet Functions 2 January 11th 05 11:01 PM


All times are GMT +1. The time now is 12:41 AM.

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"