Top 10 values in excel - excel

enter image description hereenter image description here
According to given data table, I want to find out the top 10 students on the basis of marks (by using excel query) but I think Max function is not working here. kindly suggest.

You can use Large with Match and Index to get the list:-
See the image of my example. I have used dummy values.
Step1 :- Use this formula (I have used in D column 'Top 10')
=INDEX($A$2:$B$13,MATCH(LARGE($B$2:$B$13,ROW(1:1)),$B$2:$B$13,0),1)
Step2:- Then drag this formula down for 10 rows. You will get the top 10.
Let me know if you have any questions

Try the rank functions.The original RANK has been deprecated. You can use RANK.EQ instead.
The syntax is
=RANK.EQ(value, entireRangeOfValues).
e.g. =RANK.EQ(J2,$J$2:$J$8015,0)
The last parameter allows you to specify sort order.
Depending on your needs you can also look at RANK.AVG
These differ in how they rank duplicate values.

Related

Sort and find Top and Bottom 5 values and their corresponding names

I know this is not the first time someone is asking a similar question, but me trying to execute what I found out in other answers is not working exactly as how I want it to be. I hope someone here could help me.
I got four columns, the first one is the Product Name, and the last one is its P/L%. I want to sort out top and bottom 5 P/L% value along with their corresponding Product Name. I am attaching the screenshot of a sample scenario in case if you couldn't understand what I explained.
I tried the (sort(filter)) method as found somewhere else, but it actually messed up with the second and third columns. I hope someone here can give me some simple ways.
My solution considers the case when multiple products has same value in P/L% and I use a Table object for displayed data.
Formulas to use
Top 5 Gainers values
=LARGE(ProductTable[P/L%]; ROWS($H$3:H3)), and copy down
Top 5 Gainer values
Top 5 Gainers products name
=INDEX(ProductTable[Product Name];AGGREGATE(14;6;(ROW(ProductTable[P/L%])-ROW(D$2)+1)/(ProductTable[P/L%]=H3);COUNTIF($H$3:H3;H3))), and copy down
Top 5 Gainers products name
Top 5 Loosers values
=SMALL(ProductTable[P/L%];ROWS($H$3:H3)), and copy down
Top 5 Loosers values
Top 5 Loosers products name
=INDEX(ProductTable[Product Name];AGGREGATE(14;6;(ROW(ProductTable[P/L%])-ROW(D$2)+1)/(ProductTable[P/L%]=K3);COUNTIF($K$3:K3;K3))), and copy down
Top 5 Loosers products name
Short Explanation
You must use LARGE and SMALL functions when you want to get the largest or the smallest value in a data array.
AGGREGATE function is a little bit complex to explain here so I recommend you this link to understand better. Basically, I use this formula to get the row of the gainer or looser product name into INDEX function.
ROWS($H$3:H3) returns 1, but when you copy down this formula, you get 2, 3, and so on. This is a nice way to expand the query if you need more than top 5 values.
Similar problem in:
https://www.excelforum.com/excel-formulas-and-functions/1208726-index-match-large-and-duplicates.html

Finding the MODE in Excel with VLOOKUP?

I have a question about finding the MODE in excel. The table below shows 4 different income brackets and then how many families are in each bracket
I wanted to ask if its possible to find the MODE of the data set bellow without having to write it down like i did on the right side of the table?
I tried using MAX to find the largest number of families in a single income bracket and then using VLOOKUP to find the corresponding value in the other column, but for some reason it does not work.
Use this formula instead
=VLOOKUP(MAX(B23:B26),CHOOSE({1,2},B23:B26,A23:A26),2,0)
Actually, one of the vlookup()'s limitation is to read the array from left to right only. In your problem, you have lookup values on the right side and values to return on the left. CHOOSE function here does the job for reversing the data/array for you.
GOOD LUCK

Concatenate the shortcut st, nd, rd to column value - Excel

Column A has numbers from 1 - 5 and in column B i want to concatenate the number of Column A with the relevant nth term as indicated in the image below. Any help will be greatly appreciate!
Without using VBA, your best option would be the "CHOOSE()" function.
Try something like this for any number > 0:
=IF(AND(MOD(ABS(A1),100)>10,MOD(ABS(A1),100)<14),"th",CHOOSE(MOD(ABS(A1),10)+1,"th","st","nd","rd","th","th","th","th","th","th"))
You can set up a named "key" separately, much like the table you are showing, and then reference the key to replace any number with the desired output.
You can then indexmatch/vlookup the number, referencing the table, to find the output.
For ex:
=vlookup($A1,key,2,FALSE)
you could use nested IF functions and RIGHT like this
=IF(OR(RIGHT(H2,2)="11",RIGHT(H2,2)="12",RIGHT(H2,2)="13"),CONCAT(H2,"th"),IF(RIGHT(H2,1)="1",CONCAT(H2,"st"),IF(RIGHT(H2,1)="2",CONCAT(H2,"nd"),IF(RIGHT(H2,1)="3",CONCAT(H2,"rd"),CONCAT(H2,"th")))))
Probably not the fastest performance wise

Excel multiple lookup array

I have a table that I would like it to select the smallest size picture frame that could be used based on the size values, basically return the smallest frame that would fit the image.
So far I have a vertical array formula that can select the smallest frame that will fit the size requirements but I have one column that I would want to stay static i.e another match that would only give the results from the selection with the same type ID/
My current formula is as follows:
= INDEX($A$2:$A$16,MATCH(4,MMULT((I2:L2<=$B$2:$E$16)+0,{1;1;1;1}),0))
At the minute i am just referencing the type as another lookup but i would like to have it so it will only attempt to match ones with the corresponding type, currently if the size is larger than availible within the correct type it will select a type that has that size availible.
I’ve tried to show what i mean in the screenshot! I want it to only pick up type 1 but it is selecting type 3 because the mmult is seeing that is the only one that would fit.
Help is much appreciated!
Thanks!
If the frame sizes to be looked up are in ascending order, you could use something like this
=INDEX($A$2:$A$4,MIN(IF((($B$2:$B$4>=F2)*($C$2:$C$4>=G2)*($D$2:$D$4>=H2)),ROW($C$2:$C$4)))-1,1)
based on this sort of data layout
Ended up using a load of nested if statements to section of the types to make it simpler to code
Thanks anyway peeps!

PowerPivot RANKX Function not working

I am trying to rank the values in a calculated field called PMPM in powerpivot. The formula I'm using is
RANKX(ALLSELECTED(Cost),[PMPM],,TRUE(),Dense)
but the results are wrong. Sample data here
The first column PMPM contains the fields I want to rank, PMPM2 contains the correct ranking that I put in manually for comparison. PMPMRank is the calculated field for which I use the formula above, but I don't get the correct results.
I'd appreciate any help! Thanks!
=IF(N(D2),INDEX($B$2:$B$2900,SMALL(IF($A$2:$A$2900=D2,ROW($B$2:$B$2900)-ROW($B$2)+1),COUNTIF(D$2:D2,D2))),"")
Make sure to press CTRL + ENTER otherwise this formula will not work.
Your formula works for me...?
Incidentally, your sample data is very strange - the ranking for >10 rank miss out some steps. e.g. rank 11. This isn't skip behaviour either (from what I can see of your sample data).
If you want to change the skip/dense behaviour in PP, you can insert an IF() function to choose how it behaves. For example, the below forces the RANKX column to change to SKIP instead of DENSE after the 10th ranking...
=
if(
RANKX('table',[PMPM],,TRUE(),DENSE)<=10
,RANKX('table',[PMPM],,TRUE(),DENSE)
,RANKX('table',[PMPM],,TRUE(),SKIP)
)
These are the results I get for the "dynamic" skip dense behaviour change

Resources