How to sum selected values from a table?
Hej igen Leo,
Thanks again for taking the time to help.
Your shorter formula did not work.
(I copied and pasted it.)
=SUMPRODUCT((A1:A100={"Book","Record"})*B1:B100)
The error pop-up said 'wrong formula'.
I presume that curley brackets {} is
for delimiting a matrix area.
(I use PC Win98, Excel 97)
It's okay, though. I can use the long formula (Message #3).
Your formula =SUMPRODUCT((A1:A100=F1:G1)*B1:B100)
for selection criteria (F1:G1) did work, but only
within rows. Columns did _not_ work.
For example (selection criteria cells F1:F2)
=SUMPRODUCT((A1:A100=F1:F2)*B1:B100)
If you (or anyone else) have a solution,
that would be good. If not, that's okay.
I probably can make a work-around, when the needed.
Tack igen.
Hilsen
Thomas Jedenfelt
"Leo Heuser" wrote in message ...
Hej igen, Thomas, og velbekomme.
Yes, there is a shorter way:
=SUMPRODUCT((A1:A100={"Book","Record"})*B1:B100)
or, if the names of the items to search for are in e.g. F1:G1
(Book in F1 and Record in G1)
=SUMPRODUCT((A1:A100=F1:G1)*B1:B100)
You can add items in H1, i1, J1 etc. and adjust the
formula accordingly, e.g.
=SUMPRODUCT((A1:A100=F1:J1)*B1:B100)
--
Best Regards
Leo Heuser
Excel MVP
|