I'm trying to get an an amount allocated across a few lots based on its rank. I managed to do this with the formula below (table starts at A1).
For apples =MIN(C2,$B$10-SUMIF($E$2:$E$4,"<"&E2,$D$2:$D$4))
For bananas =MIN(C5,$B$11-SUMIF($E$5:$E$7,"<"&E5,$D$5:$D$7))
Now instead of writing 2 separate formulas, I'm trying to expand this to do the same based on its group as well.
Group Lot Units Allocation Rank
Apples 1.1 29200 29062 1
Apples 1.2 2000 0 2
Apples 1.3 3000 0 3
Bananas 2.1 2778 1136 3
Bananas 2.2 2211 2211 1
Bananas 2.3 5942 5942 2
Allocation
Apples 29062
Bananas 9289
Maybe like this in row 2 and copied down
=MIN(C2,SUMIFS(D:D,A:A,A2)-SUMIFS(D:D,E:E,"<"&E2,A:A,A2))
I think I've figured it out.
=MIN(C2,INDEX($B$10:$B$11,MATCH(A2,$A$10:$A$11,0))-SUMIFS($D$2:$D$7,$A$2:$A$7,A2,$E$2:$E$7,"<"&E2))
Related
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.
I have come across of the problem that, I don't know how to solve in efficient way. So I have two tables like these:
Table 1
Company Score
Apple 10
Banana 5
Kiwi 4
Pineapple 2
Table 2
Company Score
Apple 4
Pineapple 3
Kiwi 2
Strawberry 1
Then in my result table in which I have company names listed in one column, like below. Right next to this I would like to show the differences which should be the first table values - the second table values where company names match(the list can be in different order that is why, I need to check it before subtracting).
Table 3
Company Result
Kiwi 2
Apple 6
Banana -5
Pineapple -1
I can do this with nested IF function to check every cell one by one, but I assume there might be more efficient way. I wonder if you have one.
Thanks to #ScottCraner's comment, I solved it with two sumifs subtracted from one another with this formula. I entered this in Column D66 and dragged down
=SUMIF($C$36:$C$45;$C$66:$C$75;D$36:D$45)-SUMIF($C$51:$C$60;$C$66:$C$75;D$51:D$60)
1st Sum if: Where C36-C45 is my first list of companies, C66-C75 is the list of companies that I have in the results table, D36 -D45 is the score list from the first table.
2nd Sum if: Where C51-C60 is my second list of companies, C66-C75 is the list of companies that I have in the results table, D51 -D60 is the score list from the second table.
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.
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.
I am trying to develop the formula in excel to look up multiple criteria. Specifically, how do I pull in a value for apples in NYC for location (B)?
Northeast NYC
(A) (B) (C) (D) (A) (B) (C) (D)
Grapes 3,000 2,073 751 2,000 4,253 3,500 1,832 2,500
Apples 400 3,076 2,298 900 27,250 19,000 14,250 9,000
Oranges 6.0 3.1 3.9 5.0 28.4 20.0 13.8 10.0
I have gotten the following formula to work with your data with one minor issue, you will need to fill the header columns (Northeast/NYC) to allow the match to work
=VLOOKUP(A9,A1:I5,MATCH((B9&C9),(A1:I1&A2:I2),0),FALSE)
**NB: Because the formula is using an array function you will need to execute it using the Crl-Shift-Enter command :)
here is a screenshot to let you decipher the references :)
I hope this is helpful