Finding Top 15 or Top 10% Highest Values in Excel - excel

So I will have a list of players (for fantasy baseball) that includes what team they are on and their salary - 3 columns in total. The number of players will range but could be in the 100-238 range. 238 is the max though.
I need to find the top 15 or 10% most expensive players, whichever is higher once we're done drafting. Therefore I will either have 15 players (if my list is <= 150) or will be the 10% once it gets to 155 and higher (since we're rounding).
Since based on my max I know I'll have anywhere from 15-24 players to pick from I had the following formula in a grid and just dragged down 24 rows. Column I is just numbered 1-24.
=IF(OR(COUNTIF($B$2:$B$501,"*") < 150, I3 <= ROUND(COUNTIF($B$2:$B$501,"*") * 0.1,2)),INDEX($B$2:$B$211,MATCH(1,INDEX(($D$2:$D$211=LARGE($D$2:$D$211,ROWS(J$1:J1)))*(COUNTIF(J$1:J1,$B$2:$B$211)=0),),0)),"-")
However, something is wrong as I keep getting duplicate names when I test this out with test data.
Any ideas where I am wrong?

The difficulty is duplicated salaries.......this can be accomodated......say the data is like:
Clearly Christopher, Mark, and George all share the same salary...to untangle this in E2 enter:
=RANK(D2,$D$2:$D$23,0)+COUNTIF($D$2:$D2,D2)-1
and copy down...........this assigns a unique ID to each record.....In G2 enter:
=MATCH(ROW()-1,$E$2:$E$23,0)
and copy down...in H2 enter:
=OFFSET($B$1,G2,0)
and copy down...in I2 enter:
=OFFSET($C$1,G2,0)
and copy down...finally in J2 enter:
=OFFSET($D$1,G2,0)
and copy down...........we now have:
This is a "sort-by-formula"..........Pick as many names off column H as you choose!

Related

Increase value of cells until a threshold, then display remainder and thereafter text

I have a row that begins with 50. As the row progresses from left to right, I want to increase this value by 50%. I have a threshold that is set at 200. The value cannot increase beyond this, but must show the remainder before it passes the threshold. After this, it should display the text "MAX".
To give a bit of context, I have a population of 200 people. Of this group, 50 contract a disease, which spreads throughout the population at a rate of increase of 50% of the currently infected population. Obviously you cannot infect more than 200 people as this is the threshold, and so the last cell before the first "MAX" should show the remaining number of people left to be infected, then all subsequent cells should show "MAX". e.g.
50,75,113,169,31,MAX,MAX,MAX,MAX etc
Where 31 is the remaining population to be infected (200-169) and 50+75+113+169+31 = 200. Is this possible?
Put A1 = 200, A2 = 50, put this formula to B2 and extend to C2, D2....
=IF(AND(A2>=$A$2, ISNUMBER(A2)),IF((1+0.5)*A2<$A$1,(1+0.5)*A2,$A$1-A2),"max")
Got exactly what you need
50 75 113 169 31 max max max max
Put 50 in cell A1. Then put this formula in cell B1 and fill right:
=IF(SUM($A$1:A1)=200,"MAX",IF(SUM($A$1:A1)+A1*1.5>200,200-SUM($A$1:A1),A1*1.5))
due to rounding I get a slightly different output with this:
=IF(OR(A1<INDEX(1:1,MAX(COLUMN()-2,1)),A1="Max"),"Max",ROUND(IF(A1*1.5>200,200-A1,A1*1.5),0))
Put 50 in A1 and this formula in B1 and copy over.

I am trying to find a formula that will allow me to calculate MAX/MIN without calculating anything after the current row

I want to use the Max/Min function to calculate the minimum number up to the current row, but not count anything after that row. See example below:
A B C
1 10 =MIN(A1:A1) I Want B1 to only count MIN from A1 to A1 from here, then
2 14 =MIN(A1:A2) from here I want B2 to count MIN from A1 to A2,
3 9 =MIN(A1:A3) Then A1 to A3,
4 6 =MIN(A1:A4) etc,
5 14 =MIN(A1:A5) etc.
I could go back and update each row manually, but I have over 700 rows that I want all this to apply to. Is there anyone who can help me with a solution to this problem?
Use this formula in B1, and copy downwards:
=MIN($A$1:$A1)
This is called maintaining referential integrity while writing any excel formula. It should give the desired result on copy towards right or downwards.

Excel countif(s) multiples

I'm trying to calculate the count of multiple occurrences of a figure using countif.
I have the range set but I need a calculation which can count in multiples of 50 without me having to type thousands of versions of countif (=COUNTIF(B2:B5,">=50")-COUNTIF(B2:B5,">100" etc.).
Data Count
50 1
70 1
80 1
10 0
150 3
This data should show 6 but at the moment I'm getting 4.
First you can start by making bins. you can make it with Data analysis tool or half manual
Like in the example, on A2 enter 0 and on b2 enter =a2+50
Same goes for a3 enter =b2 and last on a4 =a3+50
Now you can drag it down as much as you like.
Instaed of using countif use sumif finction. let's assume your data is on cloumn H and the values you want to sum are in column I, then on c2 enter
=SUMIFS(I:I,H:H,">"&A2,H:H,"<="&B2)
you can drag it down as much as you like.
Simply use Excels ROUNDDOWN function:
e.g. for B2: =ROUNDDOWN(A2/50,0)

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.

Top third, next third of items by sales

I have an excel sheet as shown below. I need to get the top third/ next third items by sales count. Is there a way to get this done in Excel?
Item Count
1 100
2 90
3 80
4 60
5 55
6 50
7 45
8 35
9 25
Dividing into 3 buckets, so 540/3 = ~180 items in each –
Bucket 1 – Items 1 and 2 (Count = 190)
Bucket 2 – Items 3, 4 and 5 (Count = 195)
Bucket 3 - Items 6, 7, 8, 9 (Count = 155)
There are multiple ways to achieve this. Assuming that your Item and Count data are in columns A and B, then the shortest path is to use the following formula in cell C2:
=ROUND(3*SUM($B$2:$B2)/SUM($B$2:$B$10),0)
After entering that into C2, select that cell and drag down the right-bottom corner of the cell all the way to the last row. Note the $ sign that is "missing" on purpose before the second 2. That takes care of the auto-fill behavior needed when dragging down the corner.
If you are allowed to use a helper column, you can create a computationally more efficient method using following layout:
If you want to, you can hide column C. It contains cumulative values of the different sales counts. Cell C1 is set to 0, cell C2 contains the formula =$C1+$B2. Column D then approximates the buckets by using the formula =ROUND(3*$C2/$C$10,0) in cell D2, and then again dragging down the bottom-right corner. This might be the better approach if you have many rows on your sheet.
Note that both solutions yield the same results. The value in one or more buckets could become 0, which is not exactly right. That can be avoided using ROUNDUP in stead of ROUND, but since you have not indicated clearly where you want the boundaries of the buckets to fall exactly in different situations, I thought I leave that as an exercise to you :-).

Resources