Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
my my is offline
external usenet poster
 
Posts: 12
Default sumproduct with multiple criteria in single column

What if I wanted to have the criteria text in column C and wanted to sum the
values in Column B that matches the citeria specified in Column C in Column
A?
A B C
Salary 500 Salary
Bonus 400 Bonus
Fringe 300 Fringe
Travel 100
Entertainment 100

Someone suggested using the following, if I were specifying the criteria in
quotes. And this works.
=SUMPRODUCT(--(A1:A5={"Salary","Bonus","Fringe"})*(B1:B5))

But I want to reference Column C for the criteria. I tried doing
=SUMPRODUCT(--(A1:A5={C1,C2,C3})*(B1:B5))
but Excel returns an error message if I try this formula. Any help would be
much appreciated.

Thank you!



  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default sumproduct with multiple criteria in single column

Try it like this:

=SUMPRODUCT(--(ISNUMBER(MATCH(A1:A5,C1:C3,0))),B1:B5)


=SUMPRODUCT(--(A1:A5={C1,C2,C3})*(B1:B5))


The {.....} is called an array constant. You can't use cells references in
an array constant.

--
Biff
Microsoft Excel MVP


"my" wrote in message
...
What if I wanted to have the criteria text in column C and wanted to sum
the
values in Column B that matches the citeria specified in Column C in
Column
A?
A B C
Salary 500 Salary
Bonus 400 Bonus
Fringe 300 Fringe
Travel 100
Entertainment 100

Someone suggested using the following, if I were specifying the criteria
in
quotes. And this works.
=SUMPRODUCT(--(A1:A5={"Salary","Bonus","Fringe"})*(B1:B5))

But I want to reference Column C for the criteria. I tried doing
=SUMPRODUCT(--(A1:A5={C1,C2,C3})*(B1:B5))
but Excel returns an error message if I try this formula. Any help would
be
much appreciated.

Thank you!





  #3   Report Post  
Posted to microsoft.public.excel.misc
my my is offline
external usenet poster
 
Posts: 12
Default sumproduct with multiple criteria in single column

It worked like a charm! Thank you!

If you have a moment, can you explain what this formula is doing exactly?

Thanks again,

"T. Valko" wrote:

Try it like this:

=SUMPRODUCT(--(ISNUMBER(MATCH(A1:A5,C1:C3,0))),B1:B5)


=SUMPRODUCT(--(A1:A5={C1,C2,C3})*(B1:B5))


The {.....} is called an array constant. You can't use cells references in
an array constant.

--
Biff
Microsoft Excel MVP


"my" wrote in message
...
What if I wanted to have the criteria text in column C and wanted to sum
the
values in Column B that matches the citeria specified in Column C in
Column
A?
A B C
Salary 500 Salary
Bonus 400 Bonus
Fringe 300 Fringe
Travel 100
Entertainment 100

Someone suggested using the following, if I were specifying the criteria
in
quotes. And this works.
=SUMPRODUCT(--(A1:A5={"Salary","Bonus","Fringe"})*(B1:B5))

But I want to reference Column C for the criteria. I tried doing
=SUMPRODUCT(--(A1:A5={C1,C2,C3})*(B1:B5))
but Excel returns an error message if I try this formula. Any help would
be
much appreciated.

Thank you!






  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default sumproduct with multiple criteria in single column

MATCH(A1:A5,C1:C3,0) looks up the 3 lookup values against the data table and
returns an array of row indexes and no matches

ISNUMBER is used get an array of TRUE/FALSE for those matches/mis-matches

The -- coerces that array of TRUE/FALSE to 1/0

The array of 1/0 is PRODUCT'ed with their equivalents in B1:B5 to give an
array of 500,400,300,0,0

And SUM sums it

--
HTH

Bob

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

"my" wrote in message
...
It worked like a charm! Thank you!

If you have a moment, can you explain what this formula is doing exactly?

Thanks again,

"T. Valko" wrote:

Try it like this:

=SUMPRODUCT(--(ISNUMBER(MATCH(A1:A5,C1:C3,0))),B1:B5)


=SUMPRODUCT(--(A1:A5={C1,C2,C3})*(B1:B5))


The {.....} is called an array constant. You can't use cells references
in
an array constant.

--
Biff
Microsoft Excel MVP


"my" wrote in message
...
What if I wanted to have the criteria text in column C and wanted to
sum
the
values in Column B that matches the citeria specified in Column C in
Column
A?
A B C
Salary 500 Salary
Bonus 400 Bonus
Fringe 300 Fringe
Travel 100
Entertainment 100

Someone suggested using the following, if I were specifying the
criteria
in
quotes. And this works.
=SUMPRODUCT(--(A1:A5={"Salary","Bonus","Fringe"})*(B1:B5))

But I want to reference Column C for the criteria. I tried doing
=SUMPRODUCT(--(A1:A5={C1,C2,C3})*(B1:B5))
but Excel returns an error message if I try this formula. Any help
would
be
much appreciated.

Thank you!








  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,886
Default sumproduct with multiple criteria in single column

Hi

In D1 enter
=SUMPRODUCT(--($A$1:$A$5=C1)*($B$1:$B$5))
copy down for as many entries as you have in column C.

--
Regards

Roger Govier


"my" wrote in message
...
What if I wanted to have the criteria text in column C and wanted to
sum the
values in Column B that matches the citeria specified in Column C in
Column
A?
A B C
Salary 500 Salary
Bonus 400 Bonus
Fringe 300 Fringe
Travel 100
Entertainment 100

Someone suggested using the following, if I were specifying the
criteria in
quotes. And this works.
=SUMPRODUCT(--(A1:A5={"Salary","Bonus","Fringe"})*(B1:B5))

But I want to reference Column C for the criteria. I tried doing
=SUMPRODUCT(--(A1:A5={C1,C2,C3})*(B1:B5))
but Excel returns an error message if I try this formula. Any help
would be
much appreciated.

Thank you!







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
Adding up data in multiple cells for a single criteria. Philip Excel Worksheet Functions 1 April 5th 06 11:30 AM
Sum Count of Single Criteria in Multiple Non-Adjacent columns Sam via OfficeKB.com Excel Worksheet Functions 9 July 14th 05 10:01 PM
Using Sumproduct with multiple Criteria Mark Jackson Excel Worksheet Functions 1 May 6th 05 10:07 PM
sumproduct using multiple criteria tifosi3 Excel Worksheet Functions 2 January 6th 05 08:46 PM
Sumproduct - multiple criteria in Column A briank Excel Worksheet Functions 2 January 6th 05 06:44 PM


All times are GMT +1. The time now is 05:13 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"