EXCEL SumIf with multiple conditions from another cell/array - excel

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.

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,"-"))))&"*"

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.

Related

Merge two excel sheets when UserId match in both sheets

I am currently mapping the usage of an application. The app have more than 5000 users and each of those users have different prerogatives. Because this an application used by employees of a company the only way I can segment those users is by using their coresponding service.
I have two seperate excel sheets that look like this:
1/
UserId N°connection/month
1 34
2 21
3 3
4 67
5 2
2/
UserId Name Service associated
2 Peter Department 1
5 Lily Department 2
3 Sarah Department 3
1 Gary Department 1
4 Joe Department 4
What I would like is to join those two separate excel sheets. Excel needs to merge those different informations by UserId.
So what I am looking for looks like this:
UserId N°connection/month Name Service associated
1 34 Gary Department 1
2 21 Peter Department 1
3 3 Sarah Department 3
It is important to know that the two excel sheets have a different number of rows.
Does anyone have a solution ?
Thanks in advance
VLOOKUP will work, but I would suggest INDEX and MATCH be used together - it is faster and is less fragile than VLOOKUP. It also doesn't require the UserID to be at the beginning of the row. A quick search will yield a result.
I don't know if I got your question. But if I did, this should be pretty easy to do using VLOOKUP formula on the merged sheet.
This link might help: https://www.techonthenet.com/excel/formulas/vlookup.php

Matching pairs in excel

Every week, I randomly pair together two users for a peer review. Sometimes users have the week off. Each user is assigned an ID # to make the pairing chart simple.
ID # Name Week 1 Pair Week 2 Pair Week n Pair...
1 Bob 2 3
2 Doug 1 -
3 Brian 4 1
4 Joe 3 -
5 Mary 6 7
6 Jane 5 10
7 Ron 10 5
8 Mark - -
9 Steve - -
10 Anna 7 6
I want to take this pairing chart and send out a weekly reminder email with the pairing. Emails should look like this.
Example 1:
Week 1 Pairings:
Bob
Doug
Brian
Joe
Mary
Jane
Ron
Anna
Example 2:
Week 2 Pairings:
Bob
Brian
Mary
Ron
Jane
Anna
Just each pair in one column, one after the other, no separators. I do the grouping with formatting. There should be no duplicates (for example, in Week 1 - Bob (1) is paired with Doug (2), but Doug (2) is also paired with Bob (1). Only one of these pairs should appear in the weekly reminder email).
How can I use Excel to get this information based on the original pairing chart?
F2=IFERROR(INDIRECT("B"&MOD(SMALL(IF(C$2:C$11="-","X",IF(C$2:C$11<$A$2:$A$11,C$2:C$11,$A$2:$A$11)*1000+ROW($B$2:$B$11)),ROW(A1)),1000)),"")
It is an array formula, click ctrl+shift+enter to complete.

Equal distribution formula based on preset values. Excel

e.g. There are 300 apples. There are 100 people. Each person has a preset value (represented as a number 1 to 5). 1=1 apple, if their value is 5 they get 5 apples etc. But there are 300 apples available so each person is going to get more then the value says they "deserve". Or one day there are only 200 apples and every one gets less then what the value states says they "deserve". Is this possible in excel?
NAME VALUE
john 5
james 5
sam 4
matt 5
mike 3
steve 2
etc...
This absolutely sounds like a perfect problem for Solver to handle. As you know, this in included within Excel's addins. It can deal with all the variables you mentioned.

Count the number of absent in different sheet excel

I have 6 worksheets and each containing names of workers. The first sheet just picks data from the other five sheets each representing a week day. The other five sheets contains names of workers which is in a column A, their working hours in column B and column C is whether they are absent or not. I want a way to collect information to the first sheet such that there will be a column that will count the number of days a worker has being absent.
When a worker is absent it is marked "absent" else it is left blank.
Can I use it with VLOOKUP included?
You should be able to use a "=COUNTIFS(criteria_range1,criteria1,criteria_range2,criteria2,etc.)"
statement which might look something like: "=COUNTIFS(WorkerNameRange,WorkerName,AbsentColumn,AbsentIndicator)"
or
"=COUNTIFS(ColumnA,WorkerName,ColumnC,AbsentIndicator)"
Okay, you didn't provide a lot of information, so here is my best answer based off of some made up sample data.
We will use 3 workers, George, Bob, and Steve. George works 8 hours/day, Bob 6 hours/day, and Steve 4 hours/day. So this is what I assume the Monday sheet would look like
Monday
Bob and Steve both missed work (rough weekend), so we won't count their hours on the Total sheet. We will also count this as 1 absent for both.
Worker Hours Absent
George 8
Bob 6 absent
Steve 4 absent
Tuesday
Tuesday is similar to Monday except that only Steve was absent.
Worker Hours Absent
George 8
Bob 6
Steve 4 absent
Total Sheet
We will assume that no one was absent for the rest of the week. So George should have gotten in 40 hours with 0 days absent. Bob missed a day, so he only got in 4*6=24 hours. Steve missed two days, so his hours will be 3*4=12. Bob will have 1 absent and Steve will have 2.
Worker Hours Days Absent
George 40 0
Bob 24 1
Steve 12 2
To sum up the hours they were present, we can use the following formula in the Hours column on the Total sheet.
=SUMIFS(Monday!$B$2:$B$4,Monday!$A$2:$A$4,Total!A2,Monday!$C$2:$C$4,"")+SUMIFS(Tuesday!$B$2:$B$4,Tuesday!$A$2:$A$4,Total!A2,Tuesday!$C$2:$C$4,"")+SUMIFS(Wednesday!$B$2:$B$4,Wednesday!$A$2:$A$4,Total!A2,Wednesday!$C$2:$C$4,"")+SUMIFS(Thursday!$B$2:$B$4,Thursday!$A$2:$A$4,Total!A2,Thursday!$C$2:$C$4,"")+SUMIFS(Friday!$B$2:$B$4,Friday!$A$2:$A$4,Total!A2,Friday!$C$2:$C$4,"")
What this does is uses a series of SUMIFS() functions to check each day if the name matches and if they were absent. If they weren't absent, it adds their hours to the total. If they were absent, it does nothing. So we get the correct hour totals. We could just count the absents and then do some math with the number of days absent, but I don't know if you have people who might work different hours different days (e.g. 4 hours Monday, 6 hours Tuesday, etc.)
To count the hours, we will use a simple COUNTA() function.
=COUNTA(Monday!C2,Tuesday!C2,Wednesday!C2,Thursday!C2,Friday!C2)
This counts all cells in that workers Absent columns that are not blank. This allows you flexibility to use any mark for absent as long as blank means "not absent".
There are other ways this spreadsheet could be made more robust with Table formatting, but I will leave it up to you to do the research.

Sum of values in column for each value in adjacent column

I have some data on number of pages printed which is basically a row for each print job with username and number of pages. I want a total of pages for each user.
my data looks like this:
COL1 COL2
dave 2
john 3
dave 1
sally 5
sally 1
john 2
dave 4
ben 8
and I want to end up with:
COL1 COL2
dave 7
john 5
sally 6
ben 8
=SUMIF(COL1:COL1,"dave",COL2:COL2)
Note that doing it this way will require you to enter each name individually when counting. Watch out for circular reference.
Use Pivot tables. It's exactly made for analysis as you describe. Pivot tables is a builtin feature in Excel and a quite powerful analysis tool.
Start with selecting your data to be analyzed and then make a pivot table out of that data.

Resources