Wallack
Wallack

Reputation: 792

EXCEL SumIf with multiple conditions from another cell/array

A B C
1 User Task Hours
2 Jim AA-1 10
3 Mike AA-2 12
4 Jim AA-3 13
5 Steve CC-5 14
6 Jim BB-1 15
7 Mike BB-3 5
8 Steve BB-4 10
9 Mike CC-5 8

The table is way bigger and there are more than just AA, BB and CC type of tasks.

I want to be able to get how many hours Jim spent on tasks that start by AA* or BB*

This is simple with a sumifs but the problem is when I have 20 different type of tasks and I Want to get a lot of people results.

So I want to get in a row how many hours Jim spent on AA, BB and CC tasks and in the next row how many he spent on DD, EE, FF.

Basically I would like a sumif like (just look at the last part):

('SHEET1'!C:C,'SHEET1'!E:E,$B$3,'SHEET1'!G:G,"AA*,BB*,CC*")

Or even better if the AA*,BB*,CC* part were in another cell to easily change it.

Upvotes: 0

Views: 59

Answers (2)

Wallack
Wallack

Reputation: 792

So thanks to Harun24hr answer I started to think in doing it in different steps.

As I stated above I have the following table:

A B C
1 User Task Hours
2 Jim AA-1 10
3 Mike AA-2 12
4 Jim AA-3 13
5 Steve CC-5 14
6 Jim BB-1 15
7 Mike BB-3 5
8 Steve BB-4 10
9 Mike CC-5 8

The issue is that I might have a lot of different type of tasks and I need to group some results, so I created another table to stablish the groups:

A B
1 Group Task
2 a AA*
3 a BB*
4 b CC*
5 a DD*

This new table is easier to maintain and I can then add a new column on the main table that represents the group based on this grouping table and then do the calculation with a simple sumif.

Thanks a lot for all the help.

Upvotes: 0

Harun24hr
Harun24hr

Reputation: 36780

Try the following formula-

=SUMIFS($C$2:$C$9,$A$2:$A$9,$F3,$B$2:$B$9,G$2)

You may also use following formulas.

F3==UNIQUE(A2:A9)
G2==TRANSPOSE(SORT(UNIQUE(TEXTSPLIT(B2:B9,"-"))))&"*"

enter image description here

Upvotes: 1

Related Questions