Excel: sort names by given values - excel

I had to do a little work with excel but I am stuck at the following point:
A B C D E F ....
1
2
3 "A" 1
4 "B" 0
5 "C" 1
6 "D" 2
7
8
9
My table looks something like this.
In B3:B6 I do have 4 names, in C3:C6, I do have the corresponding scores.
Now, I would like to order the names by their given points and display them in E3:E6
I am not that familiar with excel so I am very happy for any help.
Greetings,
Finn

First get the numbers in order with Large Function:
=LARGE($C$3:$C$6,ROW(A1))
Put that in F3 and copy down 4. It will list the numbers in order.
Then in E3 put this formula:
=INDEX(B:B,AGGREGATE(15,6,ROW($C$3:$C$6)/($C$3:$C$6=F3),COUNTIF($F$3:F3,F3)))
Which looks up the corresponding name.

Related

EXCEL Sum up points based on placements (combine VLOOKUP and SUM)

e.g. I have a list of race results:
A B C D E F...
NAME P. RACE1 RACE2 RACE
abc =? 1 3 3
bcd 3 2 4
cde 4 4 2
def 2 1 1
and another sheet with points for each result:
A B
PLACE POINT
1 10
2 5
3 2
4 1
Is it possible to get the total points in sheet1 column B based on the race results in column C-E..?
Is it a connection from VLOOKUP and SUM?
Yes, that's possible. You can use a SUMPRODUCT formula for that. You may use this one in column B:
=SUMPRODUCT((C2:E2=$A$13:$A$16)*$B$13:$B$16)
Your result will look like this:
This is an array function. The term C2:E2=$A$13:$A$16 will check for race 1 to 3 if it was 1st, 2nd, 3rd or 4th place. This will result in an "imaginary" array of TRUE and FALSE. For name "abc", it will look like that.
Those results are then multiplied with the points from B13:B16 and the sum is formed.
In Excel O365, one could use:
Formula in B2:
=SUM(VLOOKUP(C2:E2,H$2:I$5,2))

how to reference a specific cell in a formula if other cells match a specific value

Thanks so much for looking at my question! I am trying to create a formula that subtracts a specific value from another formula. However, that specific value may change.
Example:
A B C D
1 1 100 =(2000 - ( if A = 1, i want to subtract the C value where B =1))
1 2 250
1 3 310
1 4 .
2 1
2 2 =((2000 - ( if A = 2, i want to subtract the C value where B =1))
2 3
2 4
3 1
3 2
3 3
3 4
(A,B,C,D are the columns)
Hopefully this makes sense! I am trying to subtract the C value that goes along with the B1 value for each different A.
I was thinking an index match of some sort but wasnt exactly sure how to do that when the A's change. Thanks so much in advance for help!
INDIRECT or INDEX functions can help you. See this answer.
Would something like a nested if function work for you here? For example:
=IF(A2=1,IF(B2=1,2000-C2,"Enter calculation if B2<>1"),"Enter calculation if A2"<>1)
If this works, then you can simply copy/paste the function down the rows in column D.

Retrieve column 4 from Column 2 and 3 which contains minimum and maximum conditions along with Column 1 which is a separate value?

Hello I have a table shown below where I have letters in column 1, and min and max ranges for column 2 and 3. I am trying to retrieve the final number in column 4.
I know I can use a VLOOKUP and set the range as TRUE to get the last column. However, how would I factor in multiple columns/criteria to find match the correct range with the correct letter.
For example, I can would like to get value 4 from the last column. I would have to match with "B" and it would be between 0 and $50,000.
A 0 $50,000 1
A $50,001 $100,000 2
A $100,001 $250,000 3
B 0 $50,000 4
B $50,001 $100,000 5
B $100,001 $250,000 6
C 0 $50,000 7
C $50,001 $100,000 8
C $100,001 $250,000 9
Thank you!
Two ways:
If the pattern is the same as to the breaks of the dollar amounts then use this:
=INDEX(D:D,MATCH(G1,A:A,0)+MATCH(H1,$B$1:$B$3)-1)
Where MATCH(G1,A:A,0) returns the first row where the ID is located and MATCH(H1,$B$1:$B$3) finds the relative location of the price in the first pattern. Change $B$1:$B$3 to encompass the whole pattern.
If the patterns are different then you can use this:
=SUMIFS(D:D,A:A,G1,B:B,"<=" & H1,C:C,">=" & H1)
One more for the future when Microsoft releases FILTER():
=FILTER(D:D,(A:A=G1)*(B:B<=H1)*(C:C>=H1))
This is entered normally and does not matter the pattern.

Excel combining countifs and left function

I have a list that I'm checking against the main data.
The main data looks like:
1234 1
1235 1
1234 1
1213 2
1231 2
1212 2
1231 3
1231 3
etc
The list I'm checking against the main data is:
1
2
3
etc
For each number in my list, I want to count how many start with 123, so the output looks like:
ID 123
1 3
2 1
3 2
etc
I have each ID in the list already. To drag down for each number, I currently have countifs(a1:a8, a1,b1:b8, "123") and it's obviously producing an error. I know I need to include left somewhere in here but I'm not sure where or how to. Much thanks.
In the Main Data sheet, add a column and enter formula as eg: C1=IF(LEFT(A1,3)="123",1,0). Drag the formula for every C cell. Then use that C cell in your SUMIFS in your list sheet eg: =SUMIFS(C:C,B:B,"="&E1) E col for me is your list.
Please refer screenshots below.
Identify begins with 123
sumifs to get the output
Edit:
Another Solution: =SUMPRODUCT(--(LEFT(Maindata!$A$1:$A$8,3)="123")*(Maindata!$B$1:$B$8=Maindata!D1)). This solution works fine to me.
sumproduct with --left
You can use someproduct to do this:
=sumproduct((Maindata!$A$1:$A$8=A1)*(left(Maindata!$B$1:$B$8)="123"))
Where A1 holds the digit you're determining the amount of "values that start with 123" for, and the main data is in worksheet Maindata, range A1:B8.
Is your data in the form of text or number values? If the former, your criteria should instead be "123*" (using an asterisk for wildcard), if the latter you might be able to get away with using ">1230".

Sum values if multiple conditions met in different sheet

I have one sheet that creates a mapping of names to values (Map_Sheet). In another sheet there are values for each name in the mapping table (Data_Sheet). What I am trying to do is add values based on certain conditions in the mapping table. For example: I want to add all counts of dog by bread and color. So in the mapping table I would look for all dogs that are brown and of a certain bread and get their names and manually add them together. I want to have a formula that does the addition based upon multiple conditions from Map_Sheet.
Here is an example of the data:
Map_Sheet-
name|bread|color|age
a x b 2
b y w 3
c x b 2
d z f 4
Data_Sheet -
id|a|b|c|d
0 3 4 2 1
1 1 2 4 2
2 3 5 7 2
3 1 2 6 9
4 1 3 5 7
And for each ID in the data sheet I want a count of bread X with color B. So I would add for ID0 values for A and C, (3+2) - so ID0 = 5, etc for each id.
I cannot use VBA so I was looking into using INDEX and MATCH but I cannot wrap my head around it. Any ideas? Thanks!
If the row headers in the first sheet match the column headers in the second sheet, you can put this formula in (say) G2 of the second sheet.
=SUM(TRANSPOSE(Map!$C$2:$C$5="b")*C2:F2)
If the column headers in the second sheet were in a different order, you would have to use something like:-
=SUM(C2:F2*NOT(ISERROR(MATCH($C$1:$F$1,IF(Map!$C$2:$C$5="b",Map!$A$2:$A$5),0))))
Both of these are array formulae. You can add extra conditions to select breed as well as colour using the same basic pattern:-
=SUM(TRANSPOSE((Map!$C$2:$C$5="b")*(Map!$B$2:$B$5="x"))*C2:F2)
or
=SUM(C2:F2*NOT(ISERROR(MATCH($C$1:$F$1,IF((Map!$C$2:$C$5="b")*(Map!$B$2:$B$5="x"),Map!$A$2:$A$5),0))))

Resources