Find the winner, player with max points - excel

please give me a hint on how to make this table.
Turn
Player
Points
1
Player1
10
2
Player3
15
3
Player1
22
4
Player6
10
...and so on. Basically, each turn some player earns some points. We don't know the number of players until the end, so I can't just make a list of players aside and SUMIF their points.
I only need to find the WINNER, a player with the maximum amount of points, i.e. in this table it would be Player1 with 10+22=32 points.
I only need one cell with WINNER: Player7
Is there a nice solution for this?
I'm using Excel 365, but vba is not allowed.

With Office 365:
=LET(
ply,B2:B5,
pts,C2:C5,
unq,UNIQUE(ply),
INDEX(SORTBY(unq,SUMIFS(pts,ply,unq),-1),1,1))

I would start by limiting the size of the table, e.g. to 500 rows.
You could make it a million rows, but it will slow the calculation
Title Column D "Cumulative Points".
In cell D2 enter "=SUMIF(B$2:B2,B2,C$2:C2)" and copy it down the column to 500 rows
In cell D3, this will become "=SUMIF(B$2:B3,B3,C$2:C3)" etc.
Title Column E "Player"
In cell E2 write "= B2" and copy it down 500 rows
Title Column G "Winner"
In cell G2 write "=VLOOKUP(MAX(D$2:D$500),$D$2:$E$500,2,FALSE)"
Hide columns D and E
Picture of spreadsheet before hiding cells

Related

Displaying a label, sorted in a third column pulled from the first column according to data in the second column? i.e. Ranking

Imagine you have spreadsheet with data in a fixed # of contiguous rows.. let's say row 1 through row 20
Now let's say you have 3 columns of interest.
A, B and C
Column A is a label column.. the data in there are just string labels.. let's say types of canned food.. Tuna, Spam, Sardines, etc.
Column B is our number column.. let's say it is prices. e.g. 2 for Tuna, 5 for Spam and 3 for Sardines. These prices can change often very rapidly.. ok so prices are not the best example but let's imagine that prices change rapidly.
Now Column C is where we want to put the formula.
I would like to have a formula in Column C that will pull the labels from Column A, based on their prices in column B and rank them from highest to lowest.. that is C1 would calculate to "Spam", C2 to "Sardines" and C3 to "Tuna"
right now there are 20 rows of data.. but maybe at some other point there might be 30 or 6 or 40, etc.
So can someone help me out with the formula or at least explain what functions I need to use and the general idea involved? thanks
=IF(A2:A200<>"";SORTBY(A2:A200;B2:B200;-1);"")
You can simply use SORT formula. In this case =SORT(A1:B1000,2,-1) where A1:B1000 is range to be sorted, second parameter 2 is column number from range to sort by, 3rd parameter for order (-1 is desceding).
Place formula in C1 and you will get spilled array.

Excel: Rounding up Nearest value

Click HERE for excel file.
In the Excel file based on Column B values I am finding nearest up offer price range which is in Row number 2 in Grey Color, Offer price per sqm is incremental by $50. As you can see in Yellow color values are multiplied by offer price * Land sqm.
3rd property nearest offer price range is $750. As you can see I am using multiple columns from C, D, E, F.
Instead what I want is get the "Offer Price per/sqm" value in column "G". How to do that.?
Though you are not pretty clear about the output you want, I think you want to round the offer price to nearest 50. If so, use this in G3 (and copy down)
=MROUND(A3/B3, 50)
this will return $700 as nearest offer price. However, if you want to round only upwards i.e. towards $750, use this (and copy down)
=CEILING(A3/B3, 50)
If you want either of these formulae to return values between 650 and 800 only use either of these
=IF(AND(CEILING(A3/B3, 50)>=650, CEILING(A3/B3, 50) <=800), CEILING(A3/B3, 50), "NA")
Based on your comment, perhaps you need this?
=IF(AND(CEILING(A3/B3, 50)>=650, CEILING(A3/B3, 50) <=800), CEILING(A3/B3, 50)*B3, "NA")
I wonder if this is what you want.
[G3] =B3*INDEX($C$2:$F$2,1,MATCH("x",C3:F3,0))
You would mark the appropriate column with an "x" and the formula would multiply the price in row 2 of the first marked column with the number of sqm.
To simulate your example, an "x" would be placed inE3 and F3. The formula in G3 would ignore the F3 and show the price based on E2. If you add an "x" in D3 the lower price will be shown in G3.

To filter multiple columns with a condition on the results

I am trying to find a way of highlighting a result with multiple conditions. I have no knowledge of pivot tables. I would rather use a formula or macros. The table is organised by Dealer.
Acc NAME Add Dealer Total
68687 Sara 11 Wood 111A 0
68687 Sara 11 Wood 111A 0
32187 Sara 11 Wood 111A 0
12345 Tom 10 Main 7878C 2
12345 Tom 10 Main 7878C 2
54321 Tom 10 Main 7878C 2
My table is similar to the one above. I want to select where the Total is greater than 0 & for each Dealer each unique Account number with the lowest Account number highlighted somehow.
So the results I want for the table above would be: Dealer 7878C, Accounts 12345, 54321.
12345 being the lower of the two, it is highlighted.
I don't mind copying the results onto another sheet, as I don't want to remove any data from the sheet. I started by just filtering the Totals for >0 and I was thinking of trying to filter for unique values in Account but its the next step that I am stuck on. A countifs formula?
The sheet is quite large and I'm just not sure which is the best way to try and do it.
Thanks for any help.
There's a nice but complicated way to do it.
With your original data:
With changed data:
As you can see I've placed your data in A1:E7.
I use two array formulas, one for the Dealer in G2:G5 and one for the Accounts H2:N5. The Dealer formula is vertical, and the Accounts formula is horizontal.
For the dealers put this array formula in G2 (press Ctrl+Shift+Enter to enter it):
=IFERROR(INDEX($D$2:$D$7,SMALL(IF(($E$2:$E$7>0)*(COUNTIF($G$1:$G1,$D$2:$D$7)=0),ROW($D$2:$D$7)-1),ROW($G$1:$G1))),"")
Now copy G2 down to G3:G5 to get the rest of the relevant dealers.
For the accounts put this array formula in H2:
=IFERROR(SMALL(IF(($D$2:$D$7=$G2)*(COUNTIF($G2:G2,$A$2:$A$7)=0),$A$2:$A$7),1),"")
Now copy H2 to the right, I2:N2, and down to H3:N5.
To make the first accounts bold I simply make the H column formatted as Bold.
You can copy these formulas farther as needed. Note that the locations are important. If you want to place the formulas elsewhere you'll need to change the references accordingly.
Formulas explained
What these formulas do is check for your conditions, and then get the smallest value that hasn't been retrieved yet, in the upper / left most cells.
The two formulas are mostly the same, apart from the fact that in the account numbers we can use the actual numbers, and with the dealer we use the row number instead.
The dealer formula from the inside out:
The conditions are set in the IF part of the formula, with a multiplier * as a logical AND (TRUE*TRUE=TRUE FALSE*TRUE=FALSE).
The first condition in IF(($E$2:$E$7>0)*(COUNTIF($G$1:$G1,$D$2:$D$7)=0),... checks for the row's Total value to be greater than zero, the second condition checks that the dealer is not already present in the G column. The second condition is irrelevant in the first cell, but in the second cell G3 it becomes COUNTIF($G$1:$G2,... which returns more than 0 if the dealer already exists, and evaluate to FALSE.
If the conditions are met the IF returns the dealer's index by using its row minus 1 ROW($D$2:$D$7)-1, which returns 1 for the first etc. as the starting row is 2. Otherwise it returns FALSE which is ignored.
The SMALL function returns the k-th smallest item. It ignores the FALSE items, and in our case returns the k-th smallest index that meets the conditions (Total>0 and not already present in the results). SMALL(...,ROW($G$1:$G1) in the first cell return the first item. ROW($G$1:$G2) in the second cell G3 evaluates to 2 and returns the second smallest item, and so forth.
The INDEX function simply returns the dealer from the data according to the index.
And finally, the IFERROR is there only to hide the errors when the end of the results is reached.
based on your sample data and assuming a header row in row 1 and the left column being column A.
=COUNTIF($A$2:A2,A2)
place that in F2 and copy down. Then do a filter on the helper column =1

List all items less than average

Suppose we have following data
prices
leptop 30
pc 29
table 10
house 15
car 25
train 32
pen 45
dog 33
cat 17
TV 8
I have calculated average of these prices avg==AVERAGE(D3:D12) where D3:D12 are price columns. Now I want to choose these items or list items which has price less than average for example, I know there is function if, but how can I use it together to list all data, which satisfies the if condition?
Are you trying to list the prices that are less than the average all in the same cell?
If you're just trying to indicate whether they are or not next to the column, you could use: =IF(D3 < AVERAGE($D$3:$D$12), "Less Than", "Greater or Equal")
Edit:
http://i.imgur.com/SRTfvJe.png
Ok, to get the result you want (see image) then you need to use the following formulas (this assumes these formulas are in column F).
The first row in the column should be: =IF(B3 < AVERAGE($B$3:$B$6), A3, "") where B3 is the data and A3 is the name.
And all the other rows should be: =IF(B4 < AVERAGE($B$3:$B$6), IF(F3="", A4, F3 & ", " & A4), F3) where B4 is the data and A4 is the name.
This is how you could do with with Advanced Filter. Set-up your excel sheet as follows, and enter the formulas appropriately:
Then, go to Advanced Filter:
You will get:
In E3 and copied down:
=IF(D3<AVERAGE(D$3:D$12),C3,"")
will give a list (admittedly with spaces) if the names are in ColumnC. (Guessing that 'continue' does not mean the same cell.)
Does a filter work for your needs? If I go to the "data" tab in Excel 2010, highlight the data, and click "Filter", I can filter on items "below average" in the price column.

Creating a Top Ten list in Excel

I have been searching for a way to make a "Top Ten" list for my uncles hockey league in Excel.
There are 5 different teams with their own worksheets and I made a separate worksheet called "data" referencing all of the players and their individual stats so that I could pull my "Top Ten" from one worksheet instead of five.
The worksheet is setup as follows:
Player1 Player2 Player3 etc...
Name
Team
Goals
Assists
Points
I would like to search for the player with the highest number of "Points" and return the name, team, goals, assists, and points on a single row, and then move down for the next player, i.e.:
Name 1 Team Goals Assists Points
Name 2 Team Goals Assists Points
I have tried using multiple ways including index and hlookup with the large and match commands, but could not get anything to work.
I feel like I am missing something simple here.
If it would be easier to have the players in rows, I could do that.
I was just having a problem with my references filling in the way I wanted them to.
Initial table:
B1: =COUNTA(B6:O6)(the number of players)
B6:O6 Name
B7:O7 Team
B8:O8 Goals
B9:O9 Assists
B10:O10 Points
Formulae below determine the rank for the player. If the score of points are equal, the player having a greater number of goals ranks higher.
B4: =$B$1-RANK(B$10;$B$10:$O$10)+B8/1000, the formula is copied to the right. The result will be fractional numbers with equal integer parts for the equal amount of points.
B3: =RANK(B4;$B$4:$O$4), the formula is copied to the right
B2: =IF(COUNTIF(C$3:$O$3;B3)>0;B3+COUNTIF(C$3:$O$3;B3);B$3)
Ranked table:
A15 and down : Rank (1,2...n)
B15 and down : =HLOOKUP(A15;$A$2:$O$3;2;FALSE)
In the next columns: Name (col C), Goals (col D), Assists (col E), Points (col F)
C15: =HLOOKUP($A15;$A$2:$O$10;5;FALSE)
D15: =HLOOKUP($A15;$A$2:$O$10;7;FALSE)
E15: =HLOOKUP($A15;$A$2:$O$10;8;FALSE)
F15: =HLOOKUP($A15;$A$2:$O$10;9;FALSE)
Formulae in B11:E11 will be copied down.
Example spreadsheet: http://www.bumpclub.ee/~jyri_r/Excel/Top_players_matrix_transposed.xls
you have to transpose the table first..
select all the rows and columns of your table.
right click the first cell where you want to paste the table
click paste special option
check the transpose check-box in the dialog-box opened.
your table is now transposed. now simple sorting can give u answer
for sorting columns :
select the whole table and click on the sort option on menu bar,
now you can retrieve all 10 top teams from this sorted list.

Resources