Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialnicolaspeterson
8,569 PointsCan you select multiple criteria for a SUMIF?
Let's say I wanted the total revenue for sandals and tennis shoes, could I write that out in one function? Or would I need to add two separate functions?
1 Answer
Jason Larson
8,361 PointsThe answer depends on the program you're using. In Excel, you can do this with a SUMIFS using an array constant, and then wrapping it in a SUM. The following answer does not work in Google Docs
=SUM(SUMIFS(C:C,A:A,{"Jeans","Sandals"}))
To do what you want to do in Google docs or in Excel without using an array constant, you would need to sum 2 formulas:
=SUM(SUMIF(A:A, "Jeans",C:C),SUMIF(A:A,"Sandals",C:C))