OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Alternative formula to SUMIF - Needs more than 1 Criteria

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
mazarin
General User
General User


Joined: 16 Feb 2009
Posts: 25

PostPosted: Wed Apr 22, 2009 7:33 am    Post subject: Alternative formula to SUMIF - Needs more than 1 Criteria Reply with quote

Hello Everyone!

Let´s consider this table:

Project Code | Category | Cost
-------------------------------------
AX | 1 | 10
AX | 1 | 10
AX | 1 | 10
AX | 2 | 10
AX | 2 | 10
ZM | 1 | 10
ZM | 1 | 10
ZM | 2 | 10
ZM | 2 | 10
------------------------------------

I would like to know the total cost for project "AX" on category "1". The expected result is: "30".

Since SUMIF allows only 1 criteria, how can I get the result? I´ve tried to obtain this using array formulas and SUMPRODUCT, but I

couldn´t make it work.

Thanks!


Last edited by mazarin on Wed Apr 22, 2009 12:40 pm; edited 1 time in total
Back to top
View user's profile Send private message
JohnV
Administrator
Administrator


Joined: 07 Mar 2003
Posts: 8979
Location: Lexinton, Kentucky, USA

PostPosted: Wed Apr 22, 2009 7:51 am    Post subject: Reply with quote

Take a look at the DSUM function in Help. Note that there is a sample spreadsheet at the top of the help page that is used in the example's syntax.
Back to top
View user's profile Send private message
mazarin
General User
General User


Joined: 16 Feb 2009
Posts: 25

PostPosted: Wed Apr 22, 2009 9:40 am    Post subject: Reply with quote

Hello JohnV!
It seems that DSUM can sucessfully bring the result I want, but doesn´t fit my needs because:

1. I have dozens of criteria combinations (25+ projects and 30 categories)
2. DSUM needs a label / header identical to the database to show the results. This breaks the flexibility of the spreadsheet layout.

There is another way to bring the results?
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10065
Location: Germany

PostPosted: Wed Apr 22, 2009 10:09 am    Post subject: Reply with quote

mazarin wrote:
Hello JohnV!
It seems that DSUM can sucessfully bring the result I want, but doesn´t fit my needs because:

No, you wrote:
Quote:
I would like to know the total cost for project "CIN" on category "1". The expected result is: "50".

Alternatives are:
SUMPRODUCT, data pilots, subtotals, filters with function SUBTOTAL and using a database in the first place instead of spreadsheet lists.
_________________
Rest in peace, oooforum.org
Get help on http://forum.openoffice.org
Back to top
View user's profile Send private message
mazarin
General User
General User


Joined: 16 Feb 2009
Posts: 25

PostPosted: Wed Apr 22, 2009 12:25 pm    Post subject: Reply with quote

Could you please post a sample of the formula, Villeroy?

I´ve got an error on my question, sorry! Let me remake it:

I would like to know the total cost for project "AX" on category "1". The expected result is 30.
Back to top
View user's profile Send private message
keme
Moderator
Moderator


Joined: 30 Aug 2004
Posts: 2732
Location: Egersund, Norway

PostPosted: Wed Apr 22, 2009 11:40 pm    Post subject: Reply with quote

Assuming your data range is A2:C10, project code is text, and that the other columns are not input as text:
=SUMPRODUCT(A2:A10="AX";B2:B10=1;C2:C10)
Back to top
View user's profile Send private message
mazarin
General User
General User


Joined: 16 Feb 2009
Posts: 25

PostPosted: Thu Apr 23, 2009 4:57 am    Post subject: Reply with quote

It worked! Thanks Keme!

So I think that SUMPRODUCT it is the better solution when we need to sum a data range based on two or more criteria. It´s the perfect alternative to SUMIF.

Thanks again, and hope this thread helps other people too!
Back to top
View user's profile Send private message
keme
Moderator
Moderator


Joined: 30 Aug 2004
Posts: 2732
Location: Egersund, Norway

PostPosted: Thu Apr 23, 2009 5:34 am    Post subject: Reply with quote

You're welcome.

SUMPRODUCT() is a surprising solution to this, perhaps. Anyway, since Villeroy enlightened me about its various uses, I've been much less strained when working in Calc.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group