Sum of Vlookups advice - excel

I have a column "Uni"
E.g.
Person Uni Round 1 Round 2 Total Rank
Leia Notts 5 5 10
Hailey Notts 6 5 11
Bobby Bath 8 1 9
James Liverpool 9 1 10
Then another table:
University Total Score Rank
Notts =sum(vlookup(...))
Bath =sum(vlookup(...))
Currently, my formula returns the 'first' lookup of the keyword - e.g. for notts, it returns '10' - rather than looking up the 10 and the 11 and summing them.
How do I make it lookup and sum both values?
My current formula is =sum(vlookup(S7,B$3:Q$40,15,FALSE)) where S7 is "Notts", range, index column 15 is "total score"
There's about 8-10 of each university.

Vlookup only returns one value, you can't sum over that.
Maybe use instead something like
=SUMIF(B$3:B$40,S7,$P3:$P40)

Related

Subtotals grouped by value using COUNTIF to create ranges for SUMIF, but in a single formula

End-goal: A column with the subtotals of groups (defined in the below table as all foods listed above Zucchini, incl Zucchini).
Current attempt: create a column to define groups using COUNTIF('count all 'zucchini' thus far'). Then use SUMIF to get the total cost for the current group.
Problem: I don't know how to do this without the COUNTIF column (since SUMIF needs range C:C to be resolved first). I'd like to have it in a single formula. I looked into array formulas but not sure if/how to apply that here.
FOOD COST COUNTIF(A2:A$2;"Zucchini") SUMIF(C:C;C2;B:B)
Apple 3 0 12
Pecan 7 0 12
Zucchini 2 0 12
Apple 4 1 23
Olive 8 1 23
Pecan 6 1 23
Zucchini 5 1 23
Apple 4 2 16
Olive 9 2 16
Zucchini 3 2 16
Any ideas on how to solve either the current problem or the end-goal problem? Thanks!
Put this in C2 and copy down:
=IF(A2="Zucchini",SUM($B$1:B2)-SUM($C$1:C1),"")
It basically sums everything to the row and subtracts what is already accounted for.

Excel using SUMIF to calculate totals of multiple columns

I'm trying to use Excle's SUMIF to calculate totals of Col1 to Col5 for dates that are similar.
My formula is as follows =SUMIF($A2:$A7,A10,$B2:$F7), but this only gives me the total of a single column.
How can I get the Totals of all the columns based on the date like I've shown in my results.
Date Col 1 Col 2 Col 3 Col 4 Col 5
1/5/2017 1 2 2
1/5/2017 5 3 1
1/5/2017 9 5 5
2/5/2017 10 5 3
2/5/2017 20 10 3
2/5/2017 6 8 1 5
Desired Results
1/5/2017 15 7 7 3 1
2/5/2017 30 11 11 11 8
use below formula in cell B11
=SUMIF($A$2:$A$7,$A11,B$2:B$7)
Per the example you provided, One solution is to use SUMPRODUCT
Multiplies corresponding components in the given arrays, and returns the sum of those products
Microsoft Docs give a thorough example, but per SO etiquette, here is an example in case of link-rot: [FYI, I used absolute reference for easier filling across, arbitrary how you get it done though]
Forumlas shown:
Formula is kind of hard to see without clicking on image:
=SUMPRODUCT(($B$3:$B$8=$B$11)*C3:C8)
This basically breaks down like this, it searches the B:B column for a match, and it will naturally return a true or false for the match, or 0/1 counterparts, and multiplys that by the number found in the column to the right (C3:C8), so it will either be 1 * # = # or 0 * # = 0

Index-Match function with NOT EQUAL criteria

I am trying to use the index with match function to give me the order of people based on their rankings. My data is something like this:
A B C
1 Rank Name Score
2
3 1 Joe 100%
4 3 Bob 80%
5 1 John 100%
6 2 Dan 90%
7
8 RankOrder Name
9 1 =index(b3:b6,match(1,a3:a6,-1)) Result = Joe
10 1 =index(b3:b6,match(1&<>"b9",a3:a6,-1)) Result = John **HELP
11 2 =index(b3:b6,match(1&<>"b9&b10",a3:a6,-1)) Result = Dan **HELP
The first formula is to find who has a ranking of 1 or greater, then the second and third formula is where I'm struggling. I need to find who the has the next ranking closest to 1 but has not already been outputted in cell B9. Then the next formula would be the same but not someone that's been outputted in cell B9 & B10. Hopefully this make sense.Thanks!
Use index and aggregate with countif for aggregate's k factor.
=INDEX(B$1:B$6,AGGREGATE(15,6,ROW($3:$6)/(A$3:A$6=A9),COUNTIF(A$9:A9,A9)))

Addition for two dimensional Excel

I needed some help with conditional addition in Excel.
This is an example data:
A B C D
1 Animal January February March
2 Cat 5 6 7
3 Cat 2 3 5
4 Dog 1 4 8
How can I write SUMIF on the conditions on, add total cats for the month of March?
I have been trying to experiment with SUMIF and written something like:
=SUMIF(A:A,Cat,D:D)
This is only going to work on one dimensional, meaning colum. How do I write a formula to calculate the sum of total cats in March? Column+ March , two dimensional.
You may try this:
=SUMIF(A1:A4;"Cat";INDEX(B1:D4; 0; 3))
The value of 3 in INDEX function means the third column (March), you may change it into 2 for February, and change it into 1 for January

SUMPRODUCT INDEX MATCH

With the following data:
A B
1 CUMULATIVE PERCENTAGE OF ITEMS PRODUCED PER MONTH ("COMPLETION_TABLE")
2 Type Month 1 Month 2
3 KITTENS 0 10
4 FISH 0 20
5 BANANAS 2 5
6 APPLES 0 0
7 PEARS 0 5
8 KITTENS 0 5
9
10
11 PRICES TABLE ("PRICES_TABLE")
12 Type Value
13 APPLES 1000
14 BANANAS 5000
15 PEARS 3000
16 FISH 4000
17 KITTENS 2000
I'm attempting to use the SUMPRODUCT function to calculate the percentage change in each month and use that value as a multiple of the prices table to provide a total price per month across all types that have been produced.
I can calculate the movement as:
=SUMPRODUCT((COMPLETION_TABLE[Month 2]-COMPLETION_TABLE[Month 1]))
... but I then need to calculate the portion of the individual movement values against the price for that type and sum the resulting products together. I have been using various INDEX / MATCH combinations without much luck.
As an example: BANANAS which should =(5-2)*5000.
Written as expanded arrays I would like to do
({10;20;5;0;5;5}-{0;0;2;0;0;0})*{2000;4000;5000;1000;3000;2000}.
Use of SUMPRODUCT implies you want a single figure result. You can use SUMIF as a "pseudo lookup" within SUMPRODUCT to get the prices, e.g.
=SUMPRODUCT(C3:C8-B3:B8,SUMIF(A13:A17,A3:A8,B13:B17))
That would get you a result of 140,000 for your example
From your question I understand the result you want is an array. This is what you get with this formula:
=INDEX($B$13:$B$17,MATCH($A3:$A8,$A$13:$A$17,0))*($C3:$C8-$B3:$B8)
entered as an array formula using Ctrl Shift Enter.
I am sure there is something simpler. I am assuming that the Type in the Price Table are unique:
{=(SUM((A13=$A$3:$A$8)*$C$3:$C$8)-SUM((A13=$A$3:$A$8)*$B$3:$B$8))*SUM((A13=$A$13:$A$17)*$B$13:$B$17)

Resources