Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I test values in 2 different columns in a "sumif" formula?

0 views
Skip to first unread message

SteveS

unread,
Jun 3, 2007, 1:59:01 PM6/3/07
to
I want to sum values in column C based on a test of text values in columns A
& B. Sumif only seems to support testing the value of one column not two.
Is there a way to accomplish my goal?


Roger Govier

unread,
Jun 3, 2007, 2:02:57 PM6/3/07
to
Hi Steve

=SUMPRODUCT(($A$1:$A$100="text1")*($B$1:$B$100="text2")*$C$1:$C$100)

Change ranges to suit, but ensure that they are of equal size.
--
Regards

Roger Govier


"SteveS" <Ste...@discussions.microsoft.com> wrote in message
news:85C6D69E-72C3-468E...@microsoft.com...

Bob Phillips

unread,
Jun 3, 2007, 2:04:05 PM6/3/07
to
=SUMPRODUCT(--(A2:A200="value1"),--(B2:B200="value2),C2:C200)

SP doesn't support full columns (not until Excel 200&), but specific ranges.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"SteveS" <Ste...@discussions.microsoft.com> wrote in message
news:85C6D69E-72C3-468E...@microsoft.com...

T. Valko

unread,
Jun 3, 2007, 2:10:43 PM6/3/07
to
Try something like this:

=SUMPRODUCT(--(A1:A10="some_text"),--(B1:B10="some_text"),C1:C10)

Better to use cells to hold the criteria:

E1 = whatever
E2 = whatever

=SUMPRODUCT(--(A1:A10=E1),--(B1:B10=E2),C1:C10)

Biff

"SteveS" <Ste...@discussions.microsoft.com> wrote in message
news:85C6D69E-72C3-468E...@microsoft.com...

ShaneDevenshire

unread,
Jun 3, 2007, 2:24:00 PM6/3/07
to
Hi,

What is the advantage of this over Roger's formula?

--
Thanks,
Shane Devenshire

Dave Peterson

unread,
Jun 3, 2007, 3:08:26 PM6/3/07
to
Bob has some details--when one formula is better than the other (and under
different circumstances, each will be better than the other):

http://www.xldynamic.com/source/xld.SUMPRODUCT.html

--

Dave Peterson

T. Valko

unread,
Jun 3, 2007, 3:07:45 PM6/3/07
to
Slightly more efficient.

If you have Excel 2002 or higher use the Evaluate Formula command and see
how many steps it takes each variation of the formula to calculate. I would
use a small data set for this, like 5-10 rows.

If you actually timed the calculation the difference would probably be
negligible on a small dataset. But on a large dataset there is a
considerable difference.

Screecap:

average calc times for 10 rows and 10,000 rows

http://img46.imageshack.us/img46/4064/calctimesax7.jpg

Biff

"ShaneDevenshire" <ShaneDe...@discussions.microsoft.com> wrote in
message news:82D641A0-10E7-42E7...@microsoft.com...

ShaneDevenshire

unread,
Jun 3, 2007, 6:20:00 PM6/3/07
to
Ah! so it's a speed issue, I hadn't tested that.
--
Thanks,
Shane Devenshire

Bob Phillips

unread,
Jun 3, 2007, 6:27:24 PM6/3/07
to
It's also an aesthetic thing, it looks 'righter' to me, although there are
instances where one works and the other doesn't and vice versa.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"ShaneDevenshire" <ShaneDe...@discussions.microsoft.com> wrote in
message news:C07D27F9-14F2-4FA9...@microsoft.com...

0 new messages