Get highest values across columns - excel

I have a worksheet with colums of names and amounts. The names are in (C2:C33,J2:J33,Q2:Q33,X2:X33). The amounts are in (G2:G33,N2:N33,U2:U33,AB2:AB33).
What I'm trying to do is find the highest 8 amounts, with the coresponding name. Meaning, for example - the name in C3 corresponds to the amount in G3, the name in J3 corresponds to the amount in N3, etc.
Using:
=LARGE((G2:G33,N2:N33,U2:U33,AB2:AB33),1)
I am able to find the top 8 values (by changing the 1 to 2, 3, 4, etc.). I couldn't figure out how to 'bring along' the name with that, so I kept searching. I found an explanation that gave me this:
=INDEX($C$2:$C$33,MATCH(1,INDEX(($G$2:$G$33=LARGE($G$2:$G$33,ROWS(N$36:N36)))*(COUNTIF(N$36:N36,$C$2:$C$33)=0),),0))
Copied down 8 cells will give me the names of the highest 8 combinations, but only from that first grouping of column C using column G values.
I've been searching for how to do this for the past few weeks, and I've run out of ideas. I don't know if I can modify the first formula to also grab the names, or the second formula to go across the other 3 corresponding groups. Once I get the top 8 names and amounts on the first sheet, I need to compare those to the top 8 on more than 100 other sheets to get the top 8 overall.
Does that make sense, and is it even possible? Do I need to use VBA? I'm running Excel 2010, but I don't know if the solution will be version specific. A thousand thanks if someone can figure this one out for me!

Not completely sure what you are asking for but here is a set of normal excel code that will provide you with the first instance of the highest value and return it's corresponding cell.
=INDEX(C2:C33,MATCH(MAX(G2:G33),G2:G33,0),1)
If you are asking for the 8 highest values in that column... you would use
=INDEX(C2:C33,MATCH(LARGE(G2:G33,[replace with 1-8]),G2:G33,0),1)
Edit: Of course it won't work if there are two numbers with the same value. In that case I would use VBA, pull the numbers into a 2D array and reorder the array based on the values in column G.

Related

Excel : Copy muitple columns to rows based on one column

I'm looking for the most efficient approach to transferring information from three columns to one row, right next to each other depending on the company name.
Consider the following example:
I have a 226k data list with product details for several customers (around 30-40k).
One customer can have 2 to 50 products, each with a serial number and a product number. Check out the source data pic.
Output required: One row per customer will have all the product data, serial number, and product number next to each other.
Source data
desired output
I have never used Macro. Can someone please help me find the best way to deal with this issue?
This one is pretty tricky, you'll need to play with column numbers to adjust formula:
The customer list in column F must be typed manually or if you have Excel 365 you may benefit from UNIQUE Function. I did it manually.
My formula in cell G2 is an array formula (must be entered pressing SHIFT+CTRL+ENTER or it won't work!
=IFERROR(INDEX(SI($D$2:$D$14=$F2;CHOOSE(COLUMN()-6-INTEGER((COLUMN()-7)/3)*3;$A$2:$A$14;$B$2:$B$14;$C$2:$C$14);"");MATCH($F2;$D$2:$D$14;0)+INTEGER((COLUMN()-7)/3));"")
Drag to right and then drag to down.
My formula uses the value 6 and 7 because my data starts at column G, that means column number 7. So if you put this somewhere else, make sure you change also 7 and 6 values to the proper values!
Anyways, I've uploaded a sample to Gdrive in case you want to check the formulas by yourself.
https://docs.google.com/spreadsheets/d/1TvNUVt0ArzyFK_jsRtZfX1ja2zUgSdhR/edit?usp=sharing&ouid=114417674018837700466&rtpof=true&sd=true

Getting Top Values from One Sheet and inputting onto a different sheet

So I'm going to eventually have 3 sheets. Sheet 1 is where I have data (numbers for a category and a name associated with it. Sheet 2 is where I pull the top 5 users for each category. Sheet 3 is where I have a leaderboard for points gained.
Right now I'm trying to work with Sheet 2 (grab the top 5 performers from each category. I'm fairly new to Excel, but after some research it seemed that XLOOKUP would be the way to go. (i'll attach screenshots below.
I'm using this formula:
=XLOOKUP(LARGE('Cases Test for Categories'!$C$18:$C$55,1),'Cases Test for Categories'!$C$18:$C$55,'Cases Test for Categories'!$A$18:$A$55)
however when using it I get all 0's.
Here's a screenshot of values I'm trying to grab from "Warranty Service Request"
and here is a screenshot when applying my formula
The solution I would want is to grab the 5 largest numbers from sheet 1 with the person name as well.
I don't think that XLOOKUP can get you anywhere near what you want but the formula below will get you one step closer.
=INDEX(List,MATCH(LARGE(INDEX(List, ,2),1),INDEX(List,,2),0),1)
In fact, it's the explanation of that formula which will be of help. Here we go.
List is a named range, perhaps equal to your 'Cases Test for Categories'!$C$18:$C$55. The reason for using a name is obvious. It's shorter. In my test List = A2:B6, in case you want to reconstruct it. Column 1 has names, column 2 numbers.
The term INDEX(List,,2) specifies the second column of List. You can replace the '2' with a formula to specify different columns of the named range.
In fact, INDEX(List,,1) does specify the first column and INDEX(List,4,1) specifies the 4th cell in that column, and that is exactly what you see in my formula. All of MATCH(LARGE(INDEX(List, ,2),1),INDEX(List,,2),0) just serves to find the row number in List, in this example the number 4.
Of course, LARGE(INDEX(List, ,2),1) returns the largest number in column2 of List. The '1' can be replaced by a formula, for example ROW()-1 which would return 1 if placed in row 2 and count up from there as it's copied down. Try =ROW()-1 in any cell in row 2 and copy the formula down.
MATCH([LARGEST],INDEX(List,,2),0) returns the row number where the largest was found, and that is the number we need to return the name from the first column of List.
This will work perfectly for one column and can easily be modified to work for different columns. Your question doesn't specify how you would like to arrange the 5 results from each category but the formula can be modified a little to accommodate whatever you want. What it can not do is to deal with ties. MATCH(LARGE can only find the first of several identical results.
To break ties in this sort of operation is complicated and must be done ether by helper columns in the data table or using VBA. It's definitely the topic of another question. For now I hope that it's a problem you will not have to anticipate.

Array formula to switch selection

I am trying to determine the top 3 depending on the selected criteria, amount or count. User can choose between the two. I have the formula to determine top 3 but I don't know how to modify it to take in account of user's selection. User's selection is in J2.
In this case, count is selected but as you can see, my formula spits out amount.
I think I need an array formula nesting choose or offset or something. The formula I have in the selected cell is
=INDEX($A$3:$A$35,MATCH(1,INDEX(($E$3:$E$35=LARGE($E$3:$E$35,ROWS(I$7:I7)))*(COUNTIF(I$7:I7,$A$3:$A$35)=0),),0))
which calculates top 3. How can I get that to change depending on user selection?
Edit: I realize I can have two sets of data for each criteria and do an offset to select between the two but figured one of you wizards can probably do it all in one. (This data is used to drive a graph.)
Edit2: sorry if it was too abstract. There are two columns. E and F. E is a list of amounts. F is a list of counts. I want to find the top 3 of both. But obviously only one at a time. Depending on what the user chooses.
As you can see, even though the selection is currently count (J7), the results show the top 3 by amounts.
By using the number selected in J2, I should be able to nest an offset function to grab the column desired yes? 1 for column E, 2 for column F. That's how I understand the function to work. However, my attempts to nest has failed because I believe I need an array formula which is beyond my skillz.
Edit3: see pic. It shows the top 3 by each criteria. How do I combine them?
You could combine it into one (non-array) formula. Here is a simple example which perhaps you can adapt to your situation.
This is the formula in J7. Change the 2 in J2 to 1 and it will return the largest value in E rather than F.
=INDEX(OFFSET($E$3:$E$35,,J2-1,,),MATCH(1,INDEX((OFFSET($E$3:$E$35,,J2-1,,)=LARGE(OFFSET($E$3:$E$35,,J2-1,,),ROWS(I$7:I7)))*COUNTIF(I$7:I7,$A$3:$A$35)=0),),0))

Excel - How to locate and sum adjacent cells and over multiple columns based on criteria of other columns cells

Formula to add all occurrences where a name pops up in a column (multiple columns) and return the summed value of all adjacent cells. For more clarification see
Example Attached
In this circumstance I want it to find all of Jim's adding to 5, all of George adding to 4, and all of Terry adding to 7. The challenge is each column will have the names randomly assorted and some times the name may not show up for that day.
Is it possible to search all days for the month (for this example) and add the total of the adjacent column for each person if I input their name?
I was looking into SUMIF functions but I can only get that to work if its all in 2 columns, with the way this one is approached I can only work through multiple columns.
Thank you for any assistance!
Use SUMIF, You will need to provide the list of names:
=SUMIF(Y:AC,"Jim",Z:AD)
Note the offset but same size ranges. Also change "Jim" to a cell that contains the name you want to sum.

assigning a value based on another column in Excel

I am trying to find a quick way to assign a value for a column depending on the value of another.I want to increase the value of column A by one each time the value of column B changes.
Column A Column B
1 (520)998-7765
1 (520)998-7765
1 (520)998-7765
2 (450)877-4563
2 (450)877-4563
2 (450)877-4563
2 (450)877-4563
3 (650)989-7654
3 (650)989-7654
3 (650)989-7654
.... ....
I need to know if there is a formula that I can use to sort through 27,000 lines of data rather than assigning them one by one.
I am using a phone number as a unique identifier and I want the ID# to increase by one every time the phone number changes.
Please Help!!
Put value "1" in A2.
In A3 and after put the following function
=IF(B3=B2,A2,A2+1)
EDIT
You can make a single formula for all of the rows.
Put something like this in A2 and copy it down:
=IF(ROW(A2)=2,1,IF(B2=B1,A1,A1+1))
It seems like you are trying to extract the unique list of phone numbers? If so, there is a Remove Duplicates function in Excel (under the Data tab) that should do what you need.
You would select your full range (27,000 phone numbers) and run Remove Duplicates. Excel would then leave behind a single row for each unique number.
I believe Remove Duplicates is available for Excel 2007 or later.
If you are using an older version of Excel, here is a link that gives more information on filtering for a unique list:
Count unique values among duplicates

Resources