Help with SUMIF
Bob -
Your spreadsheet design is what's causing you this heartache. Analysis of
data like this is far, FAR easier if you have it arranged in database format
- meaning the first column indicates the date, second indicates Mgt or
NonMgt, third column indicates account number or category or whatever
currently differentiates your rows, then the final column is the value.
From that structure you can whip out a pivot table lightning fast, or use
straightforward SUMPRODUCT()s to summarize the data.
You stated that you can't use a macro to solve this, meaning that, unless
you restructure your data, you are going to have to use convoluted formulae
Bob Phillips' formula can be modified to sum row 3 by changing the 2:2
instances to 3:3 instances, and you may want to change the 1:1 reference to
$1:$1 so you can copy the formula to other rows
=SUMPRODUCT(--(MOD(COLUMN(3:3),2)*1),--($1:$1<=--"2009/04/30"),3:3)
"Bob" wrote:
Bob,
Thanks for the suggestion. However, I have several rows of data, and each
row needs to be summed separately. How would I modify your formula to do
that?
Thanks again,
Bob
"Bob Phillips" wrote:
Assuing the dates are in row 1, amounts in 2, and testing for up to and
inclduing 30th April
=SUMPRODUCT(--(MOD(COLUMN(2:2),2)*1),--(1:1<=--"2009/04/30"),2:2)
--
---
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
"Bob" wrote in message
...
For whatever it's worth, below is the current formula I've written, but it
only works when the data is in consecutive columns, not when the data is
in
every other column:
=SUMIF(INDIRECT("A2:"&ADDRESS(ROW(),MATCH(MAX($A1: $AJ1)+1,$A1:$AJ1,1))),"0")
"Bob" wrote:
Columns A & B = Jan 2008 - Mgmt. and Jan 2008 Non-Mgmt., respectively.
Columns C & D = Feb 2008 - Mgmt. and Feb 2008 Non-Mgmt., respectively.
Columns E & F = Mar 2008 - Mgmt. and Mar 2008 Non-Mgmt., respectively.
etc.
Based on a pull-down box I created where a user selects an ending period
(month-year), I'm trying to use the SUMIF function whereby it should add
up
only the "Mgmt." columns, and only up through the selcted ending period.
So
even though the worksheet contains data for all the months through the
end of
2010, if a user selects Apr 2009 as the ending period, for example, I
need
SUMIF to add only the "Mgmt." columns from Jan 2008 up to (and including)
Apr
2009.
FYI - I rigged it so that the month-year labels beyond the selected
month-year are automatically shown as being blank, thinking that I could
somehow use SUMIF to look for and stop adding every other column when it
encountered the first blank month-year label. But no such luck.
BTW, I need to solve the aforementioned problem using a worksheet
function.
I cannot use a macro (for a variety of reasons).
Any help would be greatly appreciated.
Thanks,
Bob
|